add an extra function for making sure we show all required folders
This commit is contained in:
parent
40de93100c
commit
a202418eca
4 changed files with 15 additions and 1 deletions
|
@ -780,6 +780,14 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
checkPlaceholderVisibility(dirs)
|
checkPlaceholderVisibility(dirs)
|
||||||
}
|
}
|
||||||
checkInvalidDirectories(dirs, directoryDao)
|
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<Directory>) {
|
private fun checkPlaceholderVisibility(dirs: ArrayList<Directory>) {
|
||||||
|
|
|
@ -364,4 +364,9 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
var visibleBottomActions: Int
|
var visibleBottomActions: Int
|
||||||
get() = prefs.getInt(VISIBLE_BOTTOM_ACTIONS, DEFAULT_BOTTOM_ACTIONS)
|
get() = prefs.getInt(VISIBLE_BOTTOM_ACTIONS, DEFAULT_BOTTOM_ACTIONS)
|
||||||
set(visibleBottomActions) = prefs.edit().putInt(VISIBLE_BOTTOM_ACTIONS, visibleBottomActions).apply()
|
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<String>
|
||||||
|
get() = prefs.getStringSet(EVER_SHOWN_FOLDERS, HashSet<String>())
|
||||||
|
set(everShownFolders) = prefs.edit().putStringSet(EVER_SHOWN_FOLDERS, everShownFolders).apply()
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,7 @@ const val WERE_FAVORITES_PINNED = "were_favorites_pinned"
|
||||||
const val WAS_RECYCLE_BIN_PINNED = "was_recycle_bin_pinned"
|
const val WAS_RECYCLE_BIN_PINNED = "was_recycle_bin_pinned"
|
||||||
const val USE_RECYCLE_BIN = "use_recycle_bin"
|
const val USE_RECYCLE_BIN = "use_recycle_bin"
|
||||||
const val GROUP_BY = "group_by"
|
const val GROUP_BY = "group_by"
|
||||||
|
const val EVER_SHOWN_FOLDERS = "ever_shown_folders"
|
||||||
|
|
||||||
// slideshow
|
// slideshow
|
||||||
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
const val SLIDESHOW_INTERVAL = "slideshow_interval"
|
||||||
|
|
|
@ -114,7 +114,7 @@ class MediaFetcher(val context: Context) {
|
||||||
val foldersToIgnore = arrayListOf("/storage/emulated/legacy")
|
val foldersToIgnore = arrayListOf("/storage/emulated/legacy")
|
||||||
val config = context.config
|
val config = context.config
|
||||||
val includedFolders = config.includedFolders
|
val includedFolders = config.includedFolders
|
||||||
var foldersToScan = ArrayList<String>()
|
var foldersToScan = config.everShownFolders.toList() as ArrayList
|
||||||
|
|
||||||
cursor.use {
|
cursor.use {
|
||||||
if (cursor.moveToFirst()) {
|
if (cursor.moveToFirst()) {
|
||||||
|
|
Loading…
Reference in a new issue