remember the last used pattern at batch renaming

This commit is contained in:
tibbi 2019-11-09 21:48:06 +01:00
parent bcfa9d96fc
commit 13a2aca7e3
3 changed files with 7 additions and 0 deletions

View file

@ -355,4 +355,8 @@ open class BaseConfig(val context: Context) {
var lastRenameUsed: Int
get() = prefs.getInt(LAST_RENAME_USED, RENAME_SIMPLE)
set(lastRenameUsed) = prefs.edit().putInt(LAST_RENAME_USED, lastRenameUsed).apply()
var lastRenamePatternUsed: String
get() = prefs.getString(LAST_RENAME_PATTERN_USED, "")!!
set(lastRenamePatternUsed) = prefs.edit().putString(LAST_RENAME_PATTERN_USED, lastRenamePatternUsed).apply()
}

View file

@ -119,6 +119,7 @@ const val WAS_RATE_US_PROMPT_SHOWN = "was_rate_us_prompt_shown"
const val WAS_SORTING_BY_NUMERIC_VALUE_ADDED = "was_sorting_by_numeric_value_added"
const val WAS_FOLDER_LOCKING_NOTICE_SHOWN = "was_folder_locking_notice_shown"
const val LAST_RENAME_USED = "last_rename_used"
const val LAST_RENAME_PATTERN_USED = "last_rename_pattern_used"
// licenses
internal const val LICENSE_KOTLIN = 1

View file

@ -29,6 +29,7 @@ class RenamePatternTab(context: Context, attrs: AttributeSet) : RelativeLayout(c
override fun initTab(activity: BaseSimpleActivity, paths: ArrayList<String>) {
this.activity = activity
this.paths = paths
rename_items_value.setText(activity.baseConfig.lastRenamePatternUsed)
}
override fun dialogConfirmed(callback: (success: Boolean) -> Unit) {
@ -49,6 +50,7 @@ class RenamePatternTab(context: Context, attrs: AttributeSet) : RelativeLayout(c
return
}
activity?.baseConfig?.lastRenamePatternUsed = rename_items_value.value
activity?.handleSAFDialog(sdFilePath) {
ignoreClicks = true
var pathsCnt = validPaths.size