diff --git a/app/build.gradle b/app/build.gradle index 158049f58..233965a04 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,7 +48,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.2.17' + implementation 'com.simplemobiletools:commons:5.2.18' implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'androidx.multidex:multidex:2.0.0' implementation 'it.sephiroth.android.exif:library:1.0.1' 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 eee326af9..920745ec6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt @@ -202,7 +202,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.id.menu_set_as -> setAs(getCurrentPath()) R.id.menu_slideshow -> initSlideshow() R.id.menu_copy_to -> copyMoveTo(true) - R.id.menu_move_to -> copyMoveTo(false) + R.id.menu_move_to -> moveFileTo() R.id.menu_open_with -> openPath(getCurrentPath(), true) R.id.menu_hide -> toggleFileVisibility(true) R.id.menu_unhide -> toggleFileVisibility(false) @@ -523,6 +523,12 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } } + private fun moveFileTo() { + handleDeletePasswordProtection { + copyMoveTo(false) + } + } + private fun copyMoveTo(isCopyOperation: Boolean) { val currPath = getCurrentPath() if (!isCopyOperation && currPath.startsWith(recycleBinPath)) { @@ -918,7 +924,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View return } - if (config.tempSkipDeleteConfirmation || config.skipDeleteConfirmation) { + if (config.isDeletePasswordProtectionOn) { + handleDeletePasswordProtection { + deleteConfirmed() + } + } else if (config.tempSkipDeleteConfirmation || config.skipDeleteConfirmation) { deleteConfirmed() } else { askConfirmDelete() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index b40908788..58418c0fd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -96,7 +96,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList toggleFoldersVisibility(false) R.id.cab_exclude -> tryExcludeFolder() R.id.cab_copy_to -> copyMoveTo(true) - R.id.cab_move_to -> copyMoveTo(false) + R.id.cab_move_to -> moveFilesTo() R.id.cab_select_all -> selectAll() R.id.cab_delete -> askConfirmDelete() R.id.cab_select_photo -> changeAlbumCover(false) @@ -310,6 +310,12 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList() val showHidden = activity.config.shouldShowHidden @@ -343,24 +349,28 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList activity.handleDeletePasswordProtection { deleteFolders() } + config.skipDeleteConfirmation -> deleteFolders() + else -> { + val itemsCnt = selectedKeys.size + val items = resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt) + val fileDirItem = getFirstSelectedItem() ?: return + val baseString = if (!config.useRecycleBin || (isOneItemSelected() && fileDirItem.isRecycleBin()) || (isOneItemSelected() && fileDirItem.areFavorites())) { + R.string.deletion_confirmation + } else { + R.string.move_to_recycle_bin_confirmation + } + + var question = String.format(resources.getString(baseString), items) + val warning = resources.getQuantityString(R.plurals.delete_warning, itemsCnt, itemsCnt) + question += "\n\n$warning" + ConfirmationDialog(activity, question) { + deleteFolders() + } + } } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 1e8324fde..14cb627d0 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -140,7 +140,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList restoreFiles() R.id.cab_share -> shareMedia() R.id.cab_copy_to -> copyMoveTo(true) - R.id.cab_move_to -> copyMoveTo(false) + R.id.cab_move_to -> moveFilesTo() R.id.cab_select_all -> selectAll() R.id.cab_open_with -> openPath() R.id.cab_fix_date_taken -> fixDateTaken() @@ -275,6 +275,12 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList