From efc4e241ca5c331a3c47f8652c6111a8c3b08e53 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 26 Jun 2018 16:14:51 +0200 Subject: [PATCH] add recycle bin to pinned folders by default --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 5 +++++ .../kotlin/com/simplemobiletools/gallery/helpers/Config.kt | 4 ++++ .../com/simplemobiletools/gallery/helpers/Constants.kt | 2 ++ 3 files changed, 11 insertions(+) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 8ccc7d9fc..5f9bf1867 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -114,6 +114,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { config.addPinnedFolders(hashSetOf(FAVORITES)) config.wereFavoritesPinned = true } + + if (!config.wasRecycleBinPinned) { + config.addPinnedFolders(hashSetOf(RECYCLE_BIN)) + config.wasRecycleBinPinned = true + } } override fun onStart() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt index 40b22e446..2af6c7bd7 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -349,6 +349,10 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(WERE_FAVORITES_PINNED, false) set(wereFavoritesPinned) = prefs.edit().putBoolean(WERE_FAVORITES_PINNED, wereFavoritesPinned).apply() + var wasRecycleBinPinned: Boolean + get() = prefs.getBoolean(WAS_RECYCLE_BIN_PINNED, false) + set(wasRecycleBinPinned) = prefs.edit().putBoolean(WAS_RECYCLE_BIN_PINNED, wasRecycleBinPinned).apply() + var groupBy: Int get() = prefs.getInt(GROUP_BY, GROUP_BY_NONE) set(groupBy) = prefs.edit().putInt(GROUP_BY, groupBy).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 3e8c478b1..97773caca 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -51,6 +51,7 @@ const val WAS_OTG_HANDLED = "was_otg_handled" const val TEMP_SKIP_DELETE_CONFIRMATION = "temp_skip_delete_confirmation" const val BOTTOM_ACTIONS = "bottom_actions" const val WERE_FAVORITES_PINNED = "were_favorites_pinned" +const val WAS_RECYCLE_BIN_PINNED = "was_recycle_bin_pinned" const val GROUP_BY = "group_by" // slideshow @@ -67,6 +68,7 @@ const val SLIDESHOW_SCROLL_DURATION = 500L const val NOMEDIA = ".nomedia" const val FAVORITES = "favorites" +const val RECYCLE_BIN = "recycle_bin" const val SHOW_FAVORITES = "show_favorites" const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 300000L