From 7ba0be43a91b15faf25cac319a3c538e7239d213 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 17 Dec 2018 11:18:41 +0100 Subject: [PATCH] properly handle Recycle bin and Favorites at grouping direct subfolders --- .../gallery/pro/activities/MainActivity.kt | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 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 76d68a1b2..f6597439e 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 @@ -938,7 +938,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { val currentPaths = LinkedHashSet() folders.forEach { val path = it - if (!path.equals(internalPath, true) && !path.equals(sdPath, true)) { + if (!path.equals(internalPath, true) && !path.equals(sdPath, true) && path != RECYCLE_BIN && path != FAVORITES) { if (mCurrentPathPrefix.isNotEmpty()) { if (File(path).parent.equals(mCurrentPathPrefix, true) || path == mCurrentPathPrefix) { currentPaths.add(path) @@ -956,12 +956,20 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { currentPaths.forEach { val path = it currentPaths.forEach { - if (!it.equals(path) && File(it).parent.equals(path)) { + if (!it.equals(path) && File(it).parent?.equals(path) == true) { areDirectSubfoldersAvailable = true } } } + if (mCurrentPathPrefix.isEmpty() && folders.contains(RECYCLE_BIN)) { + currentPaths.add(RECYCLE_BIN) + } + + if (mCurrentPathPrefix.isEmpty() && folders.contains(FAVORITES)) { + currentPaths.add(FAVORITES) + } + if (folders.size == currentPaths.size) { return currentPaths }