mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2025-01-18 06:17:59 +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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true && isShowHiddenFlagNeeded()) {
|
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
|
||||||
|
if (isShowHiddenFlagNeeded()) {
|
||||||
if (!config.isPasswordProtectionOn) {
|
if (!config.isPasswordProtectionOn) {
|
||||||
config.temporarilyShowHidden = true
|
config.temporarilyShowHidden = true
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
config.excludedFolders.map { "$it/" }.forEach {
|
||||||
|
if (mPath.startsWith(it)) {
|
||||||
|
config.temporarilyShowExcluded = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
showSystemUI()
|
showSystemUI()
|
||||||
|
|
||||||
mDirectory = File(mPath).parent
|
mDirectory = File(mPath).parent
|
||||||
|
@ -145,6 +153,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
|
||||||
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
|
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
|
||||||
config.temporarilyShowHidden = false
|
config.temporarilyShowHidden = false
|
||||||
}
|
}
|
||||||
|
config.temporarilyShowExcluded = false
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupOrientationEventListener() {
|
private fun setupOrientationEventListener() {
|
||||||
|
|
|
@ -72,6 +72,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP
|
||||||
val config = context.config
|
val config = context.config
|
||||||
val filterMedia = config.filterMedia
|
val filterMedia = config.filterMedia
|
||||||
val showHidden = config.shouldShowHidden
|
val showHidden = config.shouldShowHidden
|
||||||
|
val showExcluded = config.temporarilyShowExcluded
|
||||||
val includedFolders = config.includedFolders.map { "$it/" }
|
val includedFolders = config.includedFolders.map { "$it/" }
|
||||||
val excludedFolders = config.excludedFolders.map { "$it/" }
|
val excludedFolders = config.excludedFolders.map { "$it/" }
|
||||||
val noMediaFolders = context.getNoMediaFolders()
|
val noMediaFolders = context.getNoMediaFolders()
|
||||||
|
@ -137,7 +138,7 @@ private fun parseCursor(context: Context, cur: Cursor, isPickImage: Boolean, isP
|
||||||
isExcluded = true
|
isExcluded = true
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!isExcluded) {
|
if (!isExcluded || showExcluded) {
|
||||||
val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN)
|
val dateTaken = cur.getLongValue(MediaStore.Images.Media.DATE_TAKEN)
|
||||||
val dateModified = cur.getIntValue(MediaStore.Images.Media.DATE_MODIFIED) * 1000L
|
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)
|
get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false)
|
||||||
set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply()
|
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>
|
var pinnedFolders: Set<String>
|
||||||
get() = prefs.getStringSet(PINNED_FOLDERS, HashSet<String>())
|
get() = prefs.getStringSet(PINNED_FOLDERS, HashSet<String>())
|
||||||
set(pinnedFolders) = prefs.edit().putStringSet(PINNED_FOLDERS, pinnedFolders).apply()
|
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 SORT_FOLDER_PREFIX = "sort_folder_"
|
||||||
val SHOW_HIDDEN_MEDIA = "show_hidden_media"
|
val SHOW_HIDDEN_MEDIA = "show_hidden_media"
|
||||||
val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
||||||
|
val TEMPORARILY_SHOW_EXCLUDED = "temporarily_show_excluded"
|
||||||
val AUTOPLAY_VIDEOS = "autoplay_videos"
|
val AUTOPLAY_VIDEOS = "autoplay_videos"
|
||||||
val LOOP_VIDEOS = "loop_videos"
|
val LOOP_VIDEOS = "loop_videos"
|
||||||
val ANIMATE_GIFS = "animate_gifs"
|
val ANIMATE_GIFS = "animate_gifs"
|
||||||
|
|
Loading…
Reference in a new issue