From 1bc7616821e57a2e9df48013f42ae187b8b95c6e Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 16 Dec 2018 10:44:18 +0100 Subject: [PATCH] fix #1122, show full filename at delete confirmation, if deleting 1 item --- .../gallery/pro/activities/ViewPagerActivity.kt | 12 ++++++++++-- .../gallery/pro/adapters/DirectoryAdapter.kt | 7 ++++++- .../gallery/pro/adapters/MediaAdapter.kt | 11 +++++++++-- 3 files changed, 25 insertions(+), 5 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 55dc39a86..8ff340ec4 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 @@ -936,8 +936,16 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun askConfirmDelete() { - val message = if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) R.string.are_you_sure_recycle_bin else R.string.are_you_sure_delete - DeleteWithRememberDialog(this, getString(message)) { + val filename = "\"${getCurrentPath().getFilenameFromPath()}\"" + + val baseString = if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) { + R.string.move_to_recycle_bin_confirmation + } else { + R.string.deletion_confirmation + } + + val message = String.format(resources.getString(baseString), filename) + DeleteWithRememberDialog(this, message) { config.tempSkipDeleteConfirmation = it deleteConfirmed() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index bab6956e0..80ec519f3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -372,7 +372,12 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList deleteFolders() else -> { val itemsCnt = selectedKeys.size - val items = resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt) + val items = if (itemsCnt == 1) { + "\"${getSelectedPaths().first().getFilenameFromPath()}\"" + } else { + 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 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 8731f0a30..e20ea1351 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 @@ -372,8 +372,15 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList