mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-29 19:27:59 +01:00
Code cleanup (post review)
This commit is contained in:
parent
a368db9b87
commit
fb17549173
3 changed files with 9 additions and 15 deletions
|
@ -1104,10 +1104,9 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
}
|
||||
|
||||
private fun askConfirmDelete() {
|
||||
val path = getCurrentPath()
|
||||
val fileDirItem = FileDirItem(path, path.getFilenameFromPath(), getIsPathDirectory(path))
|
||||
val fileDirItem = File(getCurrentPath()).toFileDirItem(this)
|
||||
val size = fileDirItem.getProperSize(this, countHidden = true).formatSize()
|
||||
val filename = "\"${path.getFilenameFromPath()}\""
|
||||
val filename = "\"${getCurrentPath().getFilenameFromPath()}\""
|
||||
val filenameAndSize = "$filename ($size)"
|
||||
|
||||
val baseString = if (config.useRecycleBin && !getCurrentMedium()!!.getIsInRecycleBin()) {
|
||||
|
|
|
@ -595,17 +595,14 @@ class DirectoryAdapter(
|
|||
|
||||
val itemsAndSize = if (itemsCnt == 1) {
|
||||
val path = getSelectedPaths().first()
|
||||
val fileDirItem = FileDirItem(path, path.getFilenameFromPath(), activity.getIsPathDirectory(path))
|
||||
val fileDirItem = File(path).toFileDirItem(activity)
|
||||
val size = fileDirItem.getProperSize(activity, countHidden = true).formatSize()
|
||||
val folder = getSelectedPaths().first().getFilenameFromPath()
|
||||
val folder = path.getFilenameFromPath()
|
||||
"\"$folder\" ($size)"
|
||||
} else {
|
||||
val paths = getSelectedPaths()
|
||||
val fileDirItems = ArrayList<FileDirItem>(paths.size)
|
||||
paths.forEach {
|
||||
val fileDirItem = FileDirItem(it, it.getFilenameFromPath(), activity.getIsPathDirectory(it))
|
||||
fileDirItems.add(fileDirItem)
|
||||
}
|
||||
paths.forEach { fileDirItems.add(File(it).toFileDirItem(activity)) }
|
||||
val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize()
|
||||
"${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)"
|
||||
}
|
||||
|
|
|
@ -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<ThumbnailItem>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
|
||||
|
@ -462,17 +463,14 @@ class MediaAdapter(
|
|||
private fun askConfirmDelete() {
|
||||
val itemsCnt = selectedKeys.size
|
||||
val firstPath = getSelectedPaths().first()
|
||||
val fileDirItem = FileDirItem(firstPath, firstPath.getFilenameFromPath(), activity.getIsPathDirectory(firstPath))
|
||||
val fileDirItem = File(firstPath).toFileDirItem(activity)
|
||||
val size = fileDirItem.getProperSize(activity, countHidden = true).formatSize()
|
||||
val itemsAndSize = if (itemsCnt == 1) {
|
||||
"\"${firstPath.getFilenameFromPath()}\" ($size)"
|
||||
} else {
|
||||
val paths = getSelectedPaths()
|
||||
val fileDirItems = java.util.ArrayList<FileDirItem>(paths.size)
|
||||
paths.forEach {
|
||||
val fileDirItem = FileDirItem(it, it.getFilenameFromPath(), activity.getIsPathDirectory(it))
|
||||
fileDirItems.add(fileDirItem)
|
||||
}
|
||||
val fileDirItems = ArrayList<FileDirItem>(paths.size)
|
||||
paths.forEach { fileDirItems.add(File(it).toFileDirItem(activity)) }
|
||||
val size = fileDirItems.sumByLong { it.getProperSize(activity, countHidden = true) }.formatSize()
|
||||
"${resources.getQuantityString(R.plurals.delete_items, itemsCnt, itemsCnt)} ($size)"
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue