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 6a0360e9d..f64cab611 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,10 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View } private fun askConfirmDelete() { + val fileDirItem = File(getCurrentPath()).toFileDirItem(this) + val size = fileDirItem.getProperSize(this, countHidden = true).formatSize() val filename = "\"${getCurrentPath().getFilenameFromPath()}\"" + val filenameAndSize = "$filename ($size)" val baseString = if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) { R.string.move_to_recycle_bin_confirmation @@ -1112,7 +1115,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/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/MediaAdapter.kt index 2472fbe9f..754064e29 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 @@ -38,6 +38,7 @@ import kotlinx.android.synthetic.main.video_item_grid.view.media_item_holder import kotlinx.android.synthetic.main.video_item_grid.view.medium_check import kotlinx.android.synthetic.main.video_item_grid.view.medium_name import kotlinx.android.synthetic.main.video_item_grid.view.medium_thumbnail +import java.io.File class MediaAdapter( activity: BaseSimpleActivity, var media: ArrayList, val listener: MediaOperationsListener?, val isAGetIntent: Boolean, @@ -462,15 +463,25 @@ class MediaAdapter( private fun askConfirmDelete() { val itemsCnt = selectedKeys.size val firstPath = getSelectedPaths().first() - val items = if (itemsCnt == 1) { - "\"${firstPath.getFilenameFromPath()}\"" + val fileDirItem = File(firstPath).toFileDirItem(activity) + 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 = ArrayList(paths.size) + paths.forEach { + val fileDirItem = File(it).toFileDirItem(activity) + fileDirItems.add(fileDirItem) + } + val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize() + val deleteItemsString = resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt) + "$deleteItemsString ($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()