|
|
@ -53,6 +53,7 @@ class OtherConfigFragment : BasePreferenceFragment(), |
|
|
|
putPrefBoolean(PreferKey.processText, isProcessTextEnabled()) |
|
|
|
putPrefBoolean(PreferKey.processText, isProcessTextEnabled()) |
|
|
|
addPreferencesFromResource(R.xml.pref_config_other) |
|
|
|
addPreferencesFromResource(R.xml.pref_config_other) |
|
|
|
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent) |
|
|
|
upPreferenceSummary(PreferKey.userAgent, AppConfig.userAgent) |
|
|
|
|
|
|
|
upPreferenceSummary(PreferKey.preDownloadNum, AppConfig.preDownloadNum.toString()) |
|
|
|
upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString()) |
|
|
|
upPreferenceSummary(PreferKey.threadCount, AppConfig.threadCount.toString()) |
|
|
|
upPreferenceSummary(PreferKey.webPort, webPort.toString()) |
|
|
|
upPreferenceSummary(PreferKey.webPort, webPort.toString()) |
|
|
|
upPreferenceSummary(PreferKey.defaultCover, getPrefString(PreferKey.defaultCover)) |
|
|
|
upPreferenceSummary(PreferKey.defaultCover, getPrefString(PreferKey.defaultCover)) |
|
|
@ -114,6 +115,9 @@ class OtherConfigFragment : BasePreferenceFragment(), |
|
|
|
|
|
|
|
|
|
|
|
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { |
|
|
|
override fun onSharedPreferenceChanged(sharedPreferences: SharedPreferences?, key: String?) { |
|
|
|
when (key) { |
|
|
|
when (key) { |
|
|
|
|
|
|
|
PreferKey.preDownloadNum -> { |
|
|
|
|
|
|
|
upPreferenceSummary(key, AppConfig.preDownloadNum.toString()) |
|
|
|
|
|
|
|
} |
|
|
|
PreferKey.threadCount -> { |
|
|
|
PreferKey.threadCount -> { |
|
|
|
upPreferenceSummary(key, AppConfig.threadCount.toString()) |
|
|
|
upPreferenceSummary(key, AppConfig.threadCount.toString()) |
|
|
|
postEvent(PreferKey.threadCount, "") |
|
|
|
postEvent(PreferKey.threadCount, "") |
|
|
@ -149,6 +153,8 @@ class OtherConfigFragment : BasePreferenceFragment(), |
|
|
|
private fun upPreferenceSummary(preferenceKey: String, value: String?) { |
|
|
|
private fun upPreferenceSummary(preferenceKey: String, value: String?) { |
|
|
|
val preference = findPreference<Preference>(preferenceKey) ?: return |
|
|
|
val preference = findPreference<Preference>(preferenceKey) ?: return |
|
|
|
when (preferenceKey) { |
|
|
|
when (preferenceKey) { |
|
|
|
|
|
|
|
PreferKey.preDownloadNum -> preference.summary = |
|
|
|
|
|
|
|
getString(R.string.pre_download_s, value) |
|
|
|
PreferKey.threadCount -> preference.summary = getString(R.string.threads_num, value) |
|
|
|
PreferKey.threadCount -> preference.summary = getString(R.string.threads_num, value) |
|
|
|
PreferKey.webPort -> preference.summary = getString(R.string.web_port_summary, value) |
|
|
|
PreferKey.webPort -> preference.summary = getString(R.string.web_port_summary, value) |
|
|
|
else -> if (preference is ListPreference) { |
|
|
|
else -> if (preference is ListPreference) { |
|
|
|