Merge pull request #2910 from fatihergin/fix/update-skip-recycle-bin-options-usages

hide "skip recycle bin" option on delete dialog if file is already in recycle bin
This commit is contained in:
Tibor Kaputa 2023-07-25 09:29:55 +02:00 committed by GitHub
commit 83242a439a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 3 deletions

View file

@ -1070,15 +1070,18 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
val size = fileDirItem.getProperSize(this, countHidden = true).formatSize() val size = fileDirItem.getProperSize(this, countHidden = true).formatSize()
val filename = "\"${getCurrentPath().getFilenameFromPath()}\"" val filename = "\"${getCurrentPath().getFilenameFromPath()}\""
val filenameAndSize = "$filename ($size)" 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 R.string.move_to_recycle_bin_confirmation
} else { } else {
R.string.deletion_confirmation R.string.deletion_confirmation
} }
val message = String.format(resources.getString(baseString), filenameAndSize) 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 config.tempSkipDeleteConfirmation = remember
if (remember) { if (remember) {

View file

@ -508,8 +508,9 @@ class MediaAdapter(
val baseString = val baseString =
if (config.useRecycleBin && !config.tempSkipRecycleBin && !isRecycleBin) R.string.move_to_recycle_bin_confirmation else R.string.deletion_confirmation 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 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 config.tempSkipDeleteConfirmation = remember
if (remember) { if (remember) {