From d7ffc35dd0c391ff579f0f78197852557ea39b27 Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 9 Nov 2016 21:19:46 +0100 Subject: [PATCH] store the real destination path in a variable --- .../com/simplemobiletools/gallery/dialogs/CopyDialog.kt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt index cf57dd2dc..24ca4a524 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/CopyDialog.kt @@ -22,12 +22,14 @@ class CopyDialog(val activity: Activity, val files: List, val copyListener val context = activity val view = LayoutInflater.from(context).inflate(R.layout.copy_item, null) val path = files[0].parent.trimEnd('/') + var destinationPath = "" view.source.text = context.humanizePath(path) view.destination.setOnClickListener { PickAlbumDialog(activity, object : PickAlbumDialog.OnPickAlbumListener { override fun onSuccess(path: String) { + destinationPath = path view.destination.text = context.humanizePath(path) } }) @@ -42,8 +44,7 @@ class CopyDialog(val activity: Activity, val files: List, val copyListener window!!.setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_VISIBLE) show() getButton(AlertDialog.BUTTON_POSITIVE).setOnClickListener({ - val destinationPath = view.destination.value - if (destinationPath == context.resources.getString(R.string.select_destination)) { + if (destinationPath == context.resources.getString(R.string.select_destination) || destinationPath.isEmpty()) { context.toast(R.string.please_select_destination) return@setOnClickListener }