diff --git a/app/build.gradle b/app/build.gradle index ae60408f..d71503d3 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -51,7 +51,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.10.12' + implementation 'com.simplemobiletools:commons:5.10.15' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.alexvasilkov:gesture-views:2.5.2' } diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt index b48d5a4b..a87ec748 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/fragments/ItemsFragment.kt @@ -193,31 +193,38 @@ class ItemsFragment : Fragment(), ItemOperationsListener, Breadcrumbs.Breadcrumb val isSortingBySize = context!!.config.sorting and SORT_BY_SIZE != 0 if (files != null) { for (file in files) { - val curPath = file.absolutePath - val curName = file.name - if (!showHidden && curName.startsWith(".")) { - continue + val fileDirItem = getFileDirItemFromFile(file, isSortingBySize) + if (fileDirItem != null) { + items.add(fileDirItem) } - - val isDirectory = file.isDirectory - val children = if (isDirectory) file.getDirectChildrenCount(showHidden) else 0 - val size = if (isDirectory) { - if (isSortingBySize) { - file.getProperSize(showHidden) - } else { - 0L - } - } else { - file.length() - } - val fileDirItem = FileDirItem(curPath, curName, isDirectory, children, size) - items.add(fileDirItem) } } callback(path, items) } + private fun getFileDirItemFromFile(file: File, isSortingBySize: Boolean): FileDirItem? { + val curPath = file.absolutePath + val curName = file.name + if (!showHidden && curName.startsWith(".")) { + return null + } + + val isDirectory = file.isDirectory + val children = if (isDirectory) file.getDirectChildrenCount(showHidden) else 0 + val size = if (isDirectory) { + if (isSortingBySize) { + file.getProperSize(showHidden) + } else { + 0L + } + } else { + file.length() + } + + return FileDirItem(curPath, curName, isDirectory, children, size) + } + private fun itemClicked(item: FileDirItem) { if (item.isDirectory) { (activity as? MainActivity)?.apply {