mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-17 22:08:00 +01:00
temporarily show excluded folders if needed, for example at third party intents
This commit is contained in:
parent
b455721b17
commit
c04f887229
4 changed files with 19 additions and 4 deletions
|
@ -98,12 +98,20 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
return
|
||||
}
|
||||
|
||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && isShowHiddenFlagNeeded()) {
|
||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
|
||||
if (isShowHiddenFlagNeeded()) {
|
||||
if (!config.isPasswordProtectionOn) {
|
||||
config.temporarilyShowHidden = true
|
||||
}
|
||||
}
|
||||
|
||||
config.excludedFolders.map { "$it/" }.forEach {
|
||||
if (mPath.startsWith(it)) {
|
||||
config.temporarilyShowExcluded = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showSystemUI()
|
||||
|
||||
mDirectory = File(mPath).parent
|
||||
|
@ -145,6 +153,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
|||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
|
||||
config.temporarilyShowHidden = false
|
||||
}
|
||||
config.temporarilyShowExcluded = false
|
||||
}
|
||||
|
||||
private fun setupOrientationEventListener() {
|
||||
|
|
|
@ -72,6 +72,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP
|
|||
val config = context.config
|
||||
val filterMedia = config.filterMedia
|
||||
val showHidden = config.shouldShowHidden
|
||||
val showExcluded = config.temporarilyShowExcluded
|
||||
val includedFolders = config.includedFolders.map { "$it/" }
|
||||
val excludedFolders = config.excludedFolders.map { "$it/" }
|
||||
val noMediaFolders = context.getNoMediaFolders()
|
||||
|
@ -137,7 +138,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP
|
|||
isExcluded = true
|
||||
}
|
||||
|
||||
if (!isExcluded) {
|
||||
if (!isExcluded || showExcluded) {
|
||||
val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN)
|
||||
val dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L
|
||||
|
||||
|
|
|
@ -54,6 +54,10 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false)
|
||||
set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply()
|
||||
|
||||
var temporarilyShowExcluded: Boolean
|
||||
get() = prefs.getBoolean(TEMPORARILY_SHOW_EXCLUDED, false)
|
||||
set(temporarilyShowExcluded) = prefs.edit().putBoolean(TEMPORARILY_SHOW_EXCLUDED, temporarilyShowExcluded).apply()
|
||||
|
||||
var pinnedFolders: Set<String>
|
||||
get() = prefs.getStringSet(PINNED_FOLDERS, HashSet<String>())
|
||||
set(pinnedFolders) = prefs.edit().putStringSet(PINNED_FOLDERS, pinnedFolders).apply()
|
||||
|
|
|
@ -6,6 +6,7 @@ val DIRECTORY_SORT_ORDER = "directory_sort_order"
|
|||
val SORT_FOLDER_PREFIX = "sort_folder_"
|
||||
val SHOW_HIDDEN_MEDIA = "show_hidden_media"
|
||||
val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
||||
val TEMPORARILY_SHOW_EXCLUDED = "temporarily_show_excluded"
|
||||
val AUTOPLAY_VIDEOS = "autoplay_videos"
|
||||
val LOOP_VIDEOS = "loop_videos"
|
||||
val ANIMATE_GIFS = "animate_gifs"
|
||||
|
|
Loading…
Reference in a new issue