0
0
mirror of https://github.com/Ishan09811/pine.git synced 2025-04-28 09:35:08 +00:00

Update GlobalSettingsFragment.kt

This commit is contained in:
Ishan09811 2024-12-30 16:28:45 +05:30 committed by GitHub
parent 09a02965c7
commit 8bb561ba72
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -85,18 +85,16 @@ class GlobalSettingsFragment : PreferenceFragmentCompat() {
fun disablePreference(
preferenceId: String,
isEnabled: Boolean,
isDisabled: Boolean,
disabledSummary: String? = null
) {
val preference = findPreference<Preference>(preferenceId)!!
preference.isSelectable = !isEnabled
preference.isEnabled = !isEnabled
if (preference is TwoStatePreference) {
if (!isEnabled) {
preference.isChecked = false
}
preference.isSelectable = !isDisabled
preference.isEnabled = !isDisabled
if (preference is TwoStatePreference && isDisabled) {
preference.isChecked = false
}
if (!isEnabled && disabledSummary != null) {
if (isDisabled && disabledSummary != null) {
preference.summary = disabledSummary
}
}