From a96e3201a3b847d187595e43bb2eff03acf02f94 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 15 Dec 2018 23:51:27 +0100 Subject: [PATCH] add an extra check for handling only direct subfolders --- .../gallery/pro/activities/MainActivity.kt | 9 ++++++--- 1 file changed, 6 insertions(+), 3 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 326f9954d..778c07f3e 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 @@ -1006,10 +1006,13 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } } + // make sure we count only the proper direct subfolders, grouped the same way as on the main screen parentDirs.firstOrNull { it.path == longestSharedPath }?.apply { - subfoldersCount++ - if (path != child.path) { - subfoldersMediaCount += child.mediaCnt + if (path.equals(child.path, true) || path.equals(File(child.path).parent, true) || children.any { it.path.equals(File(child.path).parent, true) }) { + subfoldersCount++ + if (path != child.path) { + subfoldersMediaCount += child.mediaCnt + } } } }