Changes for readability

This commit is contained in:
Doozy 2022-05-19 10:55:26 +03:00
parent fb17549173
commit 914d97c231
2 changed files with 8 additions and 2 deletions

View file

@ -602,7 +602,10 @@ class DirectoryAdapter(
} else { } else {
val paths = getSelectedPaths() val paths = getSelectedPaths()
val fileDirItems = ArrayList<FileDirItem>(paths.size) val fileDirItems = ArrayList<FileDirItem>(paths.size)
paths.forEach { fileDirItems.add(File(it).toFileDirItem(activity)) } paths.forEach {
val fileDirItem = FileDirItem(it, it.getFilenameFromPath(), activity.getIsPathDirectory(it))
fileDirItems.add(fileDirItem)
}
val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize() val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize()
"${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)" "${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)"
} }

View file

@ -470,7 +470,10 @@ class MediaAdapter(
} else { } else {
val paths = getSelectedPaths() val paths = getSelectedPaths()
val fileDirItems = ArrayList<FileDirItem>(paths.size) val fileDirItems = ArrayList<FileDirItem>(paths.size)
paths.forEach { fileDirItems.add(File(it).toFileDirItem(activity)) } paths.forEach {
val fileDirItem = FileDirItem(it, it.getFilenameFromPath(), activity.getIsPathDirectory(it))
fileDirItems.add(fileDirItem)
}
val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize() val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize()
"${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)" "${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)"
} }