This commit is contained in:
tom5079
2020-09-02 00:13:25 +09:00
parent 7704c96955
commit 9583897ada
16 changed files with 237 additions and 140 deletions

View File

@@ -209,6 +209,9 @@ class SettingsFragment :
"proxy" -> {
summary = context?.let { getProxyInfo().type.name }
}
"download_folder" -> {
summary = FileX(context, Preferences.get<String>("download_folder")).canonicalPath
}
}
}
}
@@ -221,6 +224,11 @@ class SettingsFragment :
initPreferences()
}
override fun onDestroy() {
Preferences.unregisterOnSharedPreferenceChangeListener(this)
super.onDestroy()
}
private fun initPreferences() {
for (i in 0 until preferenceScreen.preferenceCount) {
@@ -274,13 +282,7 @@ class SettingsFragment :
onPreferenceClickListener = this@SettingsFragment
}
"download_folder" -> {
setSummaryProvider {
val uri: String = Preferences[it.key]
kotlin.runCatching {
FileX(context, uri).canonicalPath
}.getOrElse { "" }
}
summary = FileX(context, Preferences.get<String>("download_folder")).canonicalPath
onPreferenceClickListener = this@SettingsFragment
}