From d78eff3cee8dcc1452c0b92c5d3a443af20ec2a1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Sun, 1 Jul 2018 20:11:07 +0200 Subject: [PATCH] hide the Favorites folder if all items are hidden and they shouldnt be shown --- .../simplemobiletools/gallery/activities/MainActivity.kt | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 805d88198..a01474b0e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -652,6 +652,14 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun gotDirectories(newDirs: ArrayList) { + // if hidden item showing is disabled but all Favorite items are hidden, hide the Favorites folder + if (!config.shouldShowHidden) { + val favoritesFolder = newDirs.firstOrNull { it.areFavorites() } + if (favoritesFolder != null && favoritesFolder.tmb.getFilenameFromPath().startsWith('.')) { + newDirs.remove(favoritesFolder) + } + } + val dirs = getSortedDirectories(newDirs) var isPlaceholderVisible = dirs.isEmpty()