diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt index 67497269f..1fa335065 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SimpleActivity.kt @@ -18,8 +18,14 @@ open class SimpleActivity : BaseSimpleActivity() { super.onCreate(savedInstanceState) } - protected fun copyMoveFilesTo(source: String, files: ArrayList, isCopyOperation: Boolean, callback: () -> Unit) { + fun copyMoveFilesTo(files: ArrayList, isCopyOperation: Boolean, callback: () -> Unit) { + if (files.isEmpty()) { + toast(R.string.unknown_error_occurred) + return + } + copyMoveCallback = callback + val source = if (files[0].isFile) files[0].parent.trimEnd('/') else files[0].absolutePath val currPath = source.trimEnd('/') PickAlbumDialog(this, currPath) { val destinationFolder = File(it) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt index 556a49eaa..57767dcf5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -185,9 +185,8 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun copyMoveTo(isCopyOperation: Boolean) { - val currPath = File(getCurrentPath()).parent.trimEnd('/') val files = ArrayList(1).apply { add(getCurrentFile()) } - copyMoveFilesTo(currPath, files, isCopyOperation) { + copyMoveFilesTo(files, isCopyOperation) { if (!isCopyOperation) { reloadViewPager() }