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 fdb1259e4..cee9d0d83 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -780,6 +780,14 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { checkPlaceholderVisibility(dirs) } checkInvalidDirectories(dirs, directoryDao) + + val everShownFolders = config.everShownFolders as HashSet + dirs.mapTo(everShownFolders) { it.path } + + try { + config.everShownFolders = everShownFolders + } catch (ignored: Exception) { + } } private fun checkPlaceholderVisibility(dirs: ArrayList) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index ae036f904..cf0b1aa63 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -364,4 +364,9 @@ class Config(context: Context) : BaseConfig(context) { var visibleBottomActions: Int get() = prefs.getInt(VISIBLE_BOTTOM_ACTIONS, DEFAULT_BOTTOM_ACTIONS) set(visibleBottomActions) = prefs.edit().putInt(VISIBLE_BOTTOM_ACTIONS, visibleBottomActions).apply() + + // if a user hides a folder, then enables temporary hidden folder displaying, make sure we show it properly + var everShownFolders: Set + get() = prefs.getStringSet(EVER_SHOWN_FOLDERS, HashSet()) + set(everShownFolders) = prefs.edit().putStringSet(EVER_SHOWN_FOLDERS, everShownFolders).apply() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index fdde91fc2..a33adcec3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -57,6 +57,7 @@ const val WERE_FAVORITES_PINNED = "were_favorites_pinned" const val WAS_RECYCLE_BIN_PINNED = "was_recycle_bin_pinned" const val USE_RECYCLE_BIN = "use_recycle_bin" const val GROUP_BY = "group_by" +const val EVER_SHOWN_FOLDERS = "ever_shown_folders" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt index 18f95c870..5621593d9 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/MediaFetcher.kt @@ -114,7 +114,7 @@ class MediaFetcher(val context: Context) { val foldersToIgnore = arrayListOf("/storage/emulated/legacy") val config = context.config val includedFolders = config.includedFolders - var foldersToScan = ArrayList() + var foldersToScan = config.everShownFolders.toList() as ArrayList cursor.use { if (cursor.moveToFirst()) {