From 0856abfb83ba69e50917e2f3f1fcbddb5ab0722c Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 27 Jun 2018 16:34:46 +0200 Subject: [PATCH] make sure we hide the Recycle Bin folder if empty --- .../gallery/activities/MainActivity.kt | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) 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 46211993b..a3ef6ea65 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -864,9 +864,16 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } if (getFavoritePaths().isEmpty()) { - val dirsFolder = dirs.firstOrNull { it.areFavorites() } - if (dirsFolder != null) { - invalidDirs.add(dirsFolder) + val favoritesFolder = dirs.firstOrNull { it.areFavorites() } + if (favoritesFolder != null) { + invalidDirs.add(favoritesFolder) + } + } + + if (config.useRecycleBin) { + val binFolder = dirs.firstOrNull { it.path == RECYCLE_BIN } + if (binFolder != null && galleryDB.MediumDao().getDeletedMedia().isEmpty()) { + invalidDirs.add(binFolder) } }