Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit d211c652 authored by tibbi's avatar tibbi
Browse files

fixing the folder child counter

parent 4c7aeae4
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ buildscript {
        propMinSdkVersion = 16
        propTargetSdkVersion = propCompileSdkVersion
        propVersionCode = 1
        propVersionName = '3.11.49'
        propVersionName = '3.11.52'
        kotlin_version = '1.2.21'
        support_libs = '27.0.2'
    }
+2 −0
Original line number Diff line number Diff line
@@ -75,4 +75,6 @@ private fun getDirectoryFileCount(dir: File, countHiddenItems: Boolean): Int {
    return count
}

fun File.getDirectChildrenCount(countHiddenItems: Boolean) = listFiles()?.filter { if (countHiddenItems) true else !it.isHidden }?.size ?: 0

fun File.toFileDirItem(context: Context) = FileDirItem(absolutePath, name, context.getIsPathDirectory(absolutePath), 0, 0L)
+1 −1
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ data class FileDirItem(val path: String, val name: String = "", var isDirectory:
        return if (context.isPathOnOTG(path)) {
            context.getDocumentFile(path)?.listFiles()?.filter { if (countHiddenItems) true else !it.name.startsWith(".") }?.size ?: 0
        } else {
            File(path).listFiles().filter { if (countHiddenItems) true else it.isHidden }.size
            File(path).getDirectChildrenCount(countHiddenItems)
        }
    }