[Removed] showing item size for folder deletion

This commit is contained in:
Doozy 2022-05-23 11:24:41 +03:00
parent 33c1ddd761
commit 1349d4c6e0

View file

@ -592,23 +592,11 @@ class DirectoryAdapter(
} }
return return
} }
val items = if (itemsCnt == 1) {
val itemsAndSize = if (itemsCnt == 1) { val folder = getSelectedPaths().first().getFilenameFromPath()
val path = getSelectedPaths().first() "\"$folder\""
val fileDirItem = File(path).toFileDirItem(activity)
val size = fileDirItem.getProperSize(activity, countHidden = true).formatSize()
val folder = path.getFilenameFromPath()
"\"$folder\" ($size)"
} else { } else {
val paths = getSelectedPaths() resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)
val fileDirItems = ArrayList<FileDirItem>(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 fileDirItem = getFirstSelectedItem() ?: return val fileDirItem = getFirstSelectedItem() ?: return
@ -618,7 +606,7 @@ class DirectoryAdapter(
R.string.move_to_recycle_bin_confirmation R.string.move_to_recycle_bin_confirmation
} }
val question = String.format(resources.getString(baseString), itemsAndSize) val question = String.format(resources.getString(baseString), items)
val warning = resources.getQuantityString(R.plurals.delete_warning, itemsCnt, itemsCnt) val warning = resources.getQuantityString(R.plurals.delete_warning, itemsCnt, itemsCnt)
ConfirmDeleteFolderDialog(activity, question, warning) { ConfirmDeleteFolderDialog(activity, question, warning) {
deleteFolders() deleteFolders()