From 19a500f55275e2406f1c5603ee2b5ca0824aed98 Mon Sep 17 00:00:00 2001 From: fatih ergin Date: Tue, 25 Jul 2023 00:59:14 +0300 Subject: [PATCH] hide skip recycle bin option on delete dialog if file is already in recycle bin --- .../gallery/pro/activities/ViewPagerActivity.kt | 7 +++++-- .../simplemobiletools/gallery/pro/adapters/MediaAdapter.kt | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt index 585fe2df2..eb6e2c94a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/ViewPagerActivity.kt @@ -1070,15 +1070,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View val size = fileDirItem.getProperSize(this, countHidden = true).formatSize() val filename = "\"${getCurrentPath().getFilenameFromPath()}\"" val filenameAndSize = "$filename ($size)" + val isInRecycleBin = getCurrentMedium()!!.getIsInRecycleBin() - val baseString = if (config.useRecycleBin && !config.tempSkipRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) { + val baseString = if (config.useRecycleBin && !config.tempSkipRecycleBin && !isInRecycleBin) { R.string.move_to_recycle_bin_confirmation } else { R.string.deletion_confirmation } val message = String.format(resources.getString(baseString), filenameAndSize) - DeleteWithRememberDialog(this, message, config.useRecycleBin) { remember, skipRecycleBin -> + val showSkipRecycleBinOption = config.useRecycleBin && !isInRecycleBin + + DeleteWithRememberDialog(this, message, showSkipRecycleBinOption) { remember, skipRecycleBin -> config.tempSkipDeleteConfirmation = remember if (remember) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 13bf88b8a..027eedf23 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt @@ -508,8 +508,9 @@ class MediaAdapter( val baseString = if (config.useRecycleBin && !config.tempSkipRecycleBin && !isRecycleBin) R.string.move_to_recycle_bin_confirmation else R.string.deletion_confirmation val question = String.format(resources.getString(baseString), itemsAndSize) + val showSkipRecycleBinOption = config.useRecycleBin && !isRecycleBin - DeleteWithRememberDialog(activity, question, config.useRecycleBin) { remember, skipRecycleBin -> + DeleteWithRememberDialog(activity, question, showSkipRecycleBinOption) { remember, skipRecycleBin -> config.tempSkipDeleteConfirmation = remember if (remember) {