|
|
@ -51,19 +51,19 @@ class BackupConfigFragment : PreferenceFragmentCompat(), |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
addPreferencesFromResource(R.xml.pref_config_backup) |
|
|
|
addPreferencesFromResource(R.xml.pref_config_backup) |
|
|
|
findPreference<EditTextPreference>("web_dav_url")?.let { |
|
|
|
findPreference<EditTextPreference>(PreferKey.webDavUrl)?.let { |
|
|
|
it.setOnBindEditTextListener { editText -> |
|
|
|
it.setOnBindEditTextListener { editText -> |
|
|
|
ATH.setTint(editText, requireContext().accentColor) |
|
|
|
ATH.setTint(editText, requireContext().accentColor) |
|
|
|
} |
|
|
|
} |
|
|
|
bindPreferenceSummaryToValue(it) |
|
|
|
bindPreferenceSummaryToValue(it) |
|
|
|
} |
|
|
|
} |
|
|
|
findPreference<EditTextPreference>("web_dav_account")?.let { |
|
|
|
findPreference<EditTextPreference>(PreferKey.webDavAccount)?.let { |
|
|
|
it.setOnBindEditTextListener { editText -> |
|
|
|
it.setOnBindEditTextListener { editText -> |
|
|
|
ATH.setTint(editText, requireContext().accentColor) |
|
|
|
ATH.setTint(editText, requireContext().accentColor) |
|
|
|
} |
|
|
|
} |
|
|
|
bindPreferenceSummaryToValue(it) |
|
|
|
bindPreferenceSummaryToValue(it) |
|
|
|
} |
|
|
|
} |
|
|
|
findPreference<EditTextPreference>("web_dav_password")?.let { |
|
|
|
findPreference<EditTextPreference>(PreferKey.webDavPassword)?.let { |
|
|
|
it.setOnBindEditTextListener { editText -> |
|
|
|
it.setOnBindEditTextListener { editText -> |
|
|
|
ATH.setTint(editText, requireContext().accentColor) |
|
|
|
ATH.setTint(editText, requireContext().accentColor) |
|
|
|
editText.inputType = |
|
|
|
editText.inputType = |
|
|
@ -85,28 +85,33 @@ class BackupConfigFragment : PreferenceFragmentCompat(), |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
override fun onPreferenceChange(preference: Preference?, newValue: Any?): Boolean { |
|
|
|
override fun onPreferenceChange(preference: Preference?, newValue: Any?): Boolean { |
|
|
|
when { |
|
|
|
when (preference?.key) { |
|
|
|
preference?.key == "web_dav_password" -> if (newValue == null) { |
|
|
|
PreferKey.webDavUrl -> |
|
|
|
preference.summary = getString(R.string.web_dav_pw_s) |
|
|
|
if (newValue == null) { |
|
|
|
} else { |
|
|
|
preference.summary = getString(R.string.web_dav_url_s) |
|
|
|
preference.summary = "*".repeat(newValue.toString().length) |
|
|
|
} else { |
|
|
|
} |
|
|
|
preference.summary = newValue.toString() |
|
|
|
preference?.key == "web_dav_url" -> if (newValue == null) { |
|
|
|
} |
|
|
|
preference.summary = getString(R.string.web_dav_url_s) |
|
|
|
PreferKey.webDavAccount -> |
|
|
|
} else { |
|
|
|
if (newValue == null) { |
|
|
|
preference.summary = newValue.toString() |
|
|
|
preference.summary = getString(R.string.web_dav_account_s) |
|
|
|
} |
|
|
|
} else { |
|
|
|
preference?.key == "web_dav_account" -> if (newValue == null) { |
|
|
|
preference.summary = newValue.toString() |
|
|
|
preference.summary = getString(R.string.web_dav_account_s) |
|
|
|
} |
|
|
|
} else { |
|
|
|
PreferKey.webDavPassword -> |
|
|
|
preference.summary = newValue.toString() |
|
|
|
if (newValue == null) { |
|
|
|
} |
|
|
|
preference.summary = getString(R.string.web_dav_pw_s) |
|
|
|
preference is ListPreference -> { |
|
|
|
} else { |
|
|
|
val index = preference.findIndexOfValue(newValue?.toString()) |
|
|
|
preference.summary = "*".repeat(newValue.toString().length) |
|
|
|
// Set the summary to reflect the new value. |
|
|
|
} |
|
|
|
preference.setSummary(if (index >= 0) preference.entries[index] else null) |
|
|
|
else -> |
|
|
|
} |
|
|
|
if (preference is ListPreference) { |
|
|
|
else -> preference?.summary = newValue?.toString() |
|
|
|
val index = preference.findIndexOfValue(newValue?.toString()) |
|
|
|
|
|
|
|
// Set the summary to reflect the new value. |
|
|
|
|
|
|
|
preference.setSummary(if (index >= 0) preference.entries[index] else null) |
|
|
|
|
|
|
|
} else { |
|
|
|
|
|
|
|
preference?.summary = newValue?.toString() |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
return false |
|
|
|
return false |
|
|
|
} |
|
|
|
} |
|
|
|