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 72b23be1e..25e0140b6 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 @@ -1104,7 +1104,11 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun askConfirmDelete() { - val filename = "\"${getCurrentPath().getFilenameFromPath()}\"" + val path = getCurrentPath() + val fileDirItem = FileDirItem(path, path.getFilenameFromPath(), getIsPathDirectory(path)) + val size = fileDirItem.getProperSize(this, countHidden = true).formatSize() + val filename = "\"${path.getFilenameFromPath()}\"" + val filenameAndSize = "$filename ($size)" val baseString = if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) { R.string.move_to_recycle_bin_confirmation @@ -1112,7 +1116,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View R.string.deletion_confirmation } - val message = String.format(resources.getString(baseString), filename) + val message = String.format(resources.getString(baseString), filenameAndSize) 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 bc6ad8279..a12a25179 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 @@ -593,11 +593,21 @@ class DirectoryAdapter( return } - val items = if (itemsCnt == 1) { + val itemsAndSize = if (itemsCnt == 1) { + val path = getSelectedPaths().first() + val fileDirItem = FileDirItem(path, path.getFilenameFromPath(), activity.getIsPathDirectory(path)) + val size = fileDirItem.getProperSize(activity, countHidden = true).formatSize() val folder = getSelectedPaths().first().getFilenameFromPath() - "\"$folder\"" + "\"$folder\" ($size)" } else { - resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt) + val paths = getSelectedPaths() + val fileDirItems = ArrayList(paths.size) + paths.forEach { + val fileDirItem = FileDirItem(it, it.getFilenameFromPath(), activity.getIsPathDirectory(it)) + fileDirItems.add(fileDirItem) + } + val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize() + "${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)" } val fileDirItem = getFirstSelectedItem() ?: return @@ -607,7 +617,7 @@ class DirectoryAdapter( R.string.move_to_recycle_bin_confirmation } - val question = String.format(resources.getString(baseString), items) + val question = String.format(resources.getString(baseString), itemsAndSize) val warning = resources.getQuantityString(R.plurals.delete_warning, itemsCnt, itemsCnt) ConfirmDeleteFolderDialog(activity, question, warning) { deleteFolders() 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 2472fbe9f..cbe59f5cc 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 @@ -462,15 +462,24 @@ class MediaAdapter( private fun askConfirmDelete() { val itemsCnt = selectedKeys.size val firstPath = getSelectedPaths().first() - val items = if (itemsCnt == 1) { - "\"${firstPath.getFilenameFromPath()}\"" + val fileDirItem = FileDirItem(firstPath, firstPath.getFilenameFromPath(), activity.getIsPathDirectory(firstPath)) + val size = fileDirItem.getProperSize(activity, countHidden = true).formatSize() + val itemsAndSize = if (itemsCnt == 1) { + "\"${firstPath.getFilenameFromPath()}\" ($size)" } else { - resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt) + val paths = getSelectedPaths() + val fileDirItems = java.util.ArrayList(paths.size) + paths.forEach { + val fileDirItem = FileDirItem(it, it.getFilenameFromPath(), activity.getIsPathDirectory(it)) + fileDirItems.add(fileDirItem) + } + val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize() + "${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)" } val isRecycleBin = firstPath.startsWith(activity.recycleBinPath) val baseString = if (config.useRecycleBin && !isRecycleBin) R.string.move_to_recycle_bin_confirmation else R.string.deletion_confirmation - val question = String.format(resources.getString(baseString), items) + val question = String.format(resources.getString(baseString), itemsAndSize) DeleteWithRememberDialog(activity, question) { config.tempSkipDeleteConfirmation = it deleteFiles()