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 3f2f995ca..713a23aed 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -158,6 +158,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) { + config.temporarilyShowHidden = false gotDirectories(it) } mCurrAsyncTask!!.execute() @@ -179,7 +180,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } private fun temporarilyShowHidden() { - + config.temporarilyShowHidden = true + getDirectories() } private fun checkIfColorChanged() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt index 790214824..6ca074485 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/asynctasks/GetDirectoriesAsynctask.kt @@ -71,7 +71,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va private fun groupDirectories(media: ArrayList): Map { val hidden = context.resources.getString(R.string.hidden) val directories = LinkedHashMap() - val showHidden = config.showHiddenFolders + val showHidden = config.showHiddenFolders || config.temporarilyShowHidden for ((name, path, isVideo, dateModified, dateTaken, size) in media) { if (shouldStop) cancel(true) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt index 8905cca0b..2af019bfd 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/extensions/context.kt @@ -70,7 +70,7 @@ fun Context.getParents(): ArrayList { val noMediaFolders = getNoMediaFolders() val parents = ArrayList() - if (config.showHiddenFolders) { + if (config.showHiddenFolders || config.temporarilyShowHidden) { parentsSet.addAll(noMediaFolders) } @@ -79,7 +79,7 @@ fun Context.getParents(): ArrayList { parentsSet.filterTo(parents, { val file = File(it) if (file.isDirectory && file.canonicalFile == file.absoluteFile) { // filter out symbolic links too - if (!config.showHiddenFolders) { + if (!config.showHiddenFolders && !config.temporarilyShowHidden) { isFolderVisible(it, noMediaFolders) } else true 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 8e9a771df..93891608e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -44,6 +44,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(SHOW_HIDDEN_FOLDERS, false) set(showHiddenFolders) = prefs.edit().putBoolean(SHOW_HIDDEN_FOLDERS, showHiddenFolders).apply() + var temporarilyShowHidden: Boolean + get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false) + set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply() + var pinnedFolders: Set get() = prefs.getStringSet(PINNED_FOLDERS, HashSet()) set(pinnedFolders) = prefs.edit().putStringSet(PINNED_FOLDERS, pinnedFolders).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 7c5262f7c..4142e1635 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -5,6 +5,7 @@ val SORT_ORDER = "sort_order" val DIRECTORY_SORT_ORDER = "directory_sort_order" val SORT_FOLDER_PREFIX = "sort_folder_" val SHOW_HIDDEN_FOLDERS = "show_hidden_folders" +val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden" val AUTOPLAY_VIDEOS = "autoplay_videos" val LOOP_VIDEOS = "loop_videos" val ANIMATE_GIFS = "animate_gifs"