make sure the Favorites folder is pinned by default

This commit is contained in:
tibbi 2018-06-20 21:49:54 +02:00
parent cc5fbecabd
commit d4fe872a3a
3 changed files with 10 additions and 0 deletions

View file

@ -109,6 +109,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
if (!config.wasOTGHandled && hasPermission(PERMISSION_WRITE_STORAGE)) { if (!config.wasOTGHandled && hasPermission(PERMISSION_WRITE_STORAGE)) {
checkOTGInclusion() checkOTGInclusion()
} }
if (!config.wereFavoritesPinned) {
config.addPinnedFolders(hashSetOf(FAVORITES))
config.wereFavoritesPinned = true
}
} }
override fun onStart() { override fun onStart() {

View file

@ -322,4 +322,8 @@ class Config(context: Context) : BaseConfig(context) {
var tempSkipDeleteConfirmation: Boolean var tempSkipDeleteConfirmation: Boolean
get() = prefs.getBoolean(TEMP_SKIP_DELETE_CONFIRMATION, false) get() = prefs.getBoolean(TEMP_SKIP_DELETE_CONFIRMATION, false)
set(tempSkipDeleteConfirmation) = prefs.edit().putBoolean(TEMP_SKIP_DELETE_CONFIRMATION, tempSkipDeleteConfirmation).apply() set(tempSkipDeleteConfirmation) = prefs.edit().putBoolean(TEMP_SKIP_DELETE_CONFIRMATION, tempSkipDeleteConfirmation).apply()
var wereFavoritesPinned: Boolean
get() = prefs.getBoolean(WERE_FAVORITES_PINNED, false)
set(wereFavoritesPinned) = prefs.edit().putBoolean(WERE_FAVORITES_PINNED, wereFavoritesPinned).apply()
} }

View file

@ -49,6 +49,7 @@ const val LAST_FILEPICKER_PATH = "last_filepicker_path"
const val WAS_OTG_HANDLED = "was_otg_handled" const val WAS_OTG_HANDLED = "was_otg_handled"
const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation" const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation"
const val BOTTOM_ACTIONS = "bottom_actions" const val BOTTOM_ACTIONS = "bottom_actions"
const val WERE_FAVORITES_PINNED = "were_favorites_pinned"
// slideshow // slideshow
const val SLIDESHOW_INTERVAL = "slideshow_interval" const val SLIDESHOW_INTERVAL = "slideshow_interval"