|
|
|
@ -56,6 +56,7 @@ class OtherConfigFragment : PreferenceFragment(), |
|
|
|
|
upPreferenceSummary(PreferKey.defaultBookTreeUri, it) |
|
|
|
|
} |
|
|
|
|
upPreferenceSummary(PreferKey.checkSource, CheckSource.summary) |
|
|
|
|
upPreferenceSummary(PreferKey.bitmapCacheSize, AppConfig.bitmapCacheSize.toString()) |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { |
|
|
|
@ -104,6 +105,17 @@ class OtherConfigFragment : PreferenceFragment(), |
|
|
|
|
PreferKey.cleanCache -> clearCache() |
|
|
|
|
PreferKey.uploadRule -> showDialogFragment<DirectLinkUploadConfig>() |
|
|
|
|
PreferKey.checkSource -> showDialogFragment<CheckSourceConfig>() |
|
|
|
|
PreferKey.bitmapCacheSize -> { |
|
|
|
|
toastOnUi(R.string.restart_to_apply_changes) |
|
|
|
|
NumberPickerDialog(requireContext()) |
|
|
|
|
.setTitle(getString(R.string.bitmap_cache_size)) |
|
|
|
|
.setMaxValue(9999) |
|
|
|
|
.setMinValue(1) |
|
|
|
|
.setValue(AppConfig.bitmapCacheSize) |
|
|
|
|
.show { |
|
|
|
|
AppConfig.bitmapCacheSize = it |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
return super.onPreferenceTreeClick(preference) |
|
|
|
|
} |
|
|
|
@ -141,6 +153,9 @@ class OtherConfigFragment : PreferenceFragment(), |
|
|
|
|
PreferKey.checkSource -> listView.post { |
|
|
|
|
upPreferenceSummary(PreferKey.checkSource, CheckSource.summary) |
|
|
|
|
} |
|
|
|
|
PreferKey.bitmapCacheSize -> { |
|
|
|
|
upPreferenceSummary(key, AppConfig.bitmapCacheSize.toString()) |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
@ -151,6 +166,7 @@ class OtherConfigFragment : PreferenceFragment(), |
|
|
|
|
getString(R.string.pre_download_s, value) |
|
|
|
|
PreferKey.threadCount -> preference.summary = getString(R.string.threads_num, value) |
|
|
|
|
PreferKey.webPort -> preference.summary = getString(R.string.web_port_summary, value) |
|
|
|
|
PreferKey.bitmapCacheSize -> preference.summary = getString(R.string.bitmap_cache_size_summary, value) |
|
|
|
|
else -> if (preference is ListPreference) { |
|
|
|
|
val index = preference.findIndexOfValue(value) |
|
|
|
|
// Set the summary to reflect the new value. |
|
|
|
|