add an extra function for making sure we show all required folders

This commit is contained in:
tibbi 2018-07-03 23:50:17 +02:00
parent 40de93100c
commit a202418eca
4 changed files with 15 additions and 1 deletions

View file

@ -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<Directory>) {

View file

@ -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<String>
get() = prefs.getStringSet(EVER_SHOWN_FOLDERS, HashSet<String>())
set(everShownFolders) = prefs.edit().putStringSet(EVER_SHOWN_FOLDERS, everShownFolders).apply()
}

View file

@ -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"

View file

@ -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<String>()
var foldersToScan = config.everShownFolders.toList() as ArrayList
cursor.use {
if (cursor.moveToFirst()) {