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 25e0140b6..4af374bba 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,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()) { 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 a12a25179..a5a2dd928 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 @@ -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(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)" } 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 cbe59f5cc..b21ab363d 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,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(paths.size) - paths.forEach { - val fileDirItem = FileDirItem(it, it.getFilenameFromPath(), activity.getIsPathDirectory(it)) - fileDirItems.add(fileDirItem) - } + val fileDirItems = ArrayList(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)" }