From b90a933569189b767c3ece9ef3693bac8678075a Mon Sep 17 00:00:00 2001 From: fatih ergin Date: Sat, 24 Jun 2023 18:04:14 +0300 Subject: [PATCH] add remembering last copy path helpers --- .../commons/extensions/Context-storage.kt | 16 ++++++++++++++++ .../commons/helpers/BaseConfig.kt | 4 ++++ .../commons/helpers/Constants.kt | 1 + 3 files changed, 21 insertions(+) diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt index bf5413dfb..01be17c42 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/extensions/Context-storage.kt @@ -991,3 +991,19 @@ fun Context.getFileUrisFromFileDirItems(fileDirItems: List): List 1 } + + if (showHidden || isLastCopyPathVisible) { + lastCopyPath + } else { + currentPath + } + } else { + currentPath + } +} diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt index ff06dc429..69762e9e3 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/BaseConfig.kt @@ -195,6 +195,10 @@ open class BaseConfig(val context: Context) { fun getFolderProtectionType(path: String) = prefs.getInt("$PROTECTED_FOLDER_TYPE$path", PROTECTION_NONE) + var lastCopyPath: String + get() = prefs.getString(LAST_COPY_PATH, "")!! + set(lastCopyPath) = prefs.edit().putString(LAST_COPY_PATH, lastCopyPath).apply() + var keepLastModified: Boolean get() = prefs.getBoolean(KEEP_LAST_MODIFIED, true) set(keepLastModified) = prefs.edit().putBoolean(KEEP_LAST_MODIFIED, keepLastModified).apply() diff --git a/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt b/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt index efefd40ab..c424285af 100644 --- a/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt +++ b/commons/src/main/kotlin/com/simplemobiletools/commons/helpers/Constants.kt @@ -121,6 +121,7 @@ const val WAS_CUSTOM_THEME_SWITCH_DESCRIPTION_SHOWN = "was_custom_theme_switch_d const val SHOW_INFO_BUBBLE = "show_info_bubble" const val LAST_CONFLICT_RESOLUTION = "last_conflict_resolution" const val LAST_CONFLICT_APPLY_TO_ALL = "last_conflict_apply_to_all" +const val LAST_COPY_PATH = "last_copy_path" const val HAD_THANK_YOU_INSTALLED = "had_thank_you_installed" const val SKIP_DELETE_CONFIRMATION = "skip_delete_confirmation" const val ENABLE_PULL_TO_REFRESH = "enable_pull_to_refresh"