From 9488795de84dd8d0a0195b4a972e1773512cb048 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 14 Dec 2018 22:39:42 +0100 Subject: [PATCH] show subfolders count at the main screen, if grouping is enabled --- .../gallery/pro/activities/MainActivity.kt | 7 ++++++- .../gallery/pro/adapters/DirectoryAdapter.kt | 3 ++- .../com/simplemobiletools/gallery/pro/models/Directory.kt | 7 +++++-- 3 files changed, 13 insertions(+), 4 deletions(-) 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