From da8a7625c972b0a0fbe374176688ab66b9a04e5e Mon Sep 17 00:00:00 2001 From: cketti Date: Tue, 2 Jan 2024 13:18:35 +0100 Subject: [PATCH] Update notification preferences when fragment is created --- .../settings/account/AccountSettingsFragment.kt | 16 ++++------------ 1 file changed, 4 insertions(+), 12 deletions(-) diff --git a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt index bf4bee2228b..c00a08cbdbb 100644 --- a/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt +++ b/app/ui/legacy/src/main/java/com/fsck/k9/ui/settings/account/AccountSettingsFragment.kt @@ -208,17 +208,14 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) { findPreference(PREFERENCE_NOTIFICATION_SOUND)?.let { preference -> notificationSoundPreference = preference - preference.isEnabled = false } findPreference(PREFERENCE_NOTIFICATION_LIGHT)?.let { preference -> notificationLightPreference = preference - preference.isEnabled = false } findPreference(PREFERENCE_NOTIFICATION_VIBRATION)?.let { preference -> notificationVibrationPreference = preference - preference.isEnabled = false } findPreference(PREFERENCE_NOTIFICATION_SETTINGS_MESSAGES)?.let { @@ -232,6 +229,8 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr notificationChannelManager.getChannelIdFor(account, ChannelType.MISCELLANEOUS) } } + + updateNotificationPreferences(account) } else { findPreference(PREFERENCE_NOTIFICATION_CHANNELS).remove() } @@ -251,15 +250,9 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr notificationSettingsUpdater.updateNotificationSettings(account) val notificationSettings = account.notificationSettings - notificationSoundPreference?.let { preference -> - preference.setNotificationSound(notificationSettings.ringtone?.toUri()) - preference.isEnabled = true - } + notificationSoundPreference?.setNotificationSound(notificationSettings.ringtone?.toUri()) - notificationLightPreference?.let { preference -> - preference.value = notificationSettings.light.name - preference.isEnabled = true - } + notificationLightPreference?.value = notificationSettings.light.name notificationVibrationPreference?.let { preference -> val notificationVibration = notificationSettings.vibration @@ -268,7 +261,6 @@ class AccountSettingsFragment : PreferenceFragmentCompat(), ConfirmationDialogFr vibratePattern = notificationVibration.pattern, vibrationTimes = notificationVibration.repeatCount, ) - preference.isEnabled = true } }