diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index db11c197b..39d5a7b85 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -957,7 +957,11 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private fun getDirsToShow(dirs: ArrayList): ArrayList { return if (config.groupDirectSubfolders) { - dirs.forEach { it.subfoldersMediaCount = it.mediaCnt } + dirs.forEach { + it.subfoldersCount = 1 + it.subfoldersMediaCount = it.mediaCnt + } + val dirFolders = dirs.map { it.path }.sorted().toMutableSet() as HashSet val foldersToShow = getDirectParentSubfolders(dirFolders) val newDirs = dirs.filter { foldersToShow.contains(it.path) } as ArrayList @@ -968,6 +972,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { var longestSharedPath = "" newDirs.forEach { if (it.path != mainDir.path && mainDir.path.startsWith(it.path, true) && it.path.length > longestSharedPath.length) { + it.subfoldersCount += 1 longestSharedPath = it.path } } 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 61b53d188..bab6956e0 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 @@ -38,6 +38,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList name