From 2bd20c5d98490a926faf4837198e5c1186a28b3a Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 10 Apr 2018 20:19:15 +0200 Subject: [PATCH] fix #735, remember last selected folder at adding excluded ones --- .../gallery/activities/ExcludedFoldersActivity.kt | 3 ++- .../gallery/activities/HiddenFoldersActivity.kt | 3 ++- .../gallery/activities/IncludedFoldersActivity.kt | 3 ++- .../kotlin/com/simplemobiletools/gallery/helpers/Config.kt | 4 ++++ .../kotlin/com/simplemobiletools/gallery/helpers/Constants.kt | 1 + 5 files changed, 11 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt index c9fb9820a..d59f0b7f4 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt @@ -49,7 +49,8 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } private fun addFolder() { - FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden) { + FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { + config.lastFilepickerPath = it config.addExcludedFolder(it) updateFolders() } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt index e1e33aec3..598e153be 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt @@ -53,7 +53,8 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } private fun addFolder() { - FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden) { + FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { + config.lastFilepickerPath = it Thread { addNoMedia(it) { updateFolders() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt index be04fbdf4..cbbb5e701 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt @@ -50,7 +50,8 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } private fun addFolder() { - FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden) { + FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { + config.lastFilepickerPath = it config.addIncludedFolder(it) updateFolders() Thread { 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 27aa99116..a76deb83c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Config.kt @@ -326,4 +326,8 @@ class Config(context: Context) : BaseConfig(context) { var wasNewAppShown: Boolean get() = prefs.getBoolean(WAS_NEW_APP_SHOWN, false) set(wasNewAppShown) = prefs.edit().putBoolean(WAS_NEW_APP_SHOWN, wasNewAppShown).apply() + + var lastFilepickerPath: String + get() = prefs.getString(TEMP_FOLDER_PATH, "") + set(tempFolderPath) = prefs.edit().putString(TEMP_FOLDER_PATH, tempFolderPath).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 005222b09..c0431b69c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -48,6 +48,7 @@ const val ALLOW_INSTANT_CHANGE = "allow_instant_change" const val REPLACE_ZOOMABLE_IMAGES = "replace_zoomable_images" const val DO_EXTRA_CHECK = "do_extra_check" const val WAS_NEW_APP_SHOWN = "was_new_app_shown_clock" +const val LAST_FILEPICKER_PATH = "last_filepicker_path" // slideshow const val SLIDESHOW_INTERVAL = "slideshow_interval"