From c2b99c591ffed520efbf0b8fd94bdb0f44c70423 Mon Sep 17 00:00:00 2001 From: Marcel Hibbe Date: Mon, 25 Nov 2024 19:55:36 +0100 Subject: [PATCH] disable sound notification settings when main notification permission is is not permitted. Otherwise user can't enable them anyway Signed-off-by: Marcel Hibbe --- .../talk/settings/SettingsActivity.kt | 10 +++ app/src/main/res/layout/activity_settings.xml | 75 +++++++++---------- 2 files changed, 47 insertions(+), 38 deletions(-) diff --git a/app/src/main/java/com/nextcloud/talk/settings/SettingsActivity.kt b/app/src/main/java/com/nextcloud/talk/settings/SettingsActivity.kt index 61e07ca60..558133cb4 100644 --- a/app/src/main/java/com/nextcloud/talk/settings/SettingsActivity.kt +++ b/app/src/main/java/com/nextcloud/talk/settings/SettingsActivity.kt @@ -333,12 +333,22 @@ class SettingsActivity : BaseActivity(), SetPhoneNumberDialogFragment.SetPhoneNu binding.ncDiagnoseNotificationPermissionSubtitle.setTextColor( resources.getColor(R.color.high_emphasis_text, null) ) + binding.settingsCallSound.isEnabled = true + binding.settingsCallSound.alpha = ENABLED_ALPHA + binding.settingsMessageSound.isEnabled = true + binding.settingsMessageSound.alpha = ENABLED_ALPHA } else { binding.ncDiagnoseNotificationPermissionSubtitle.text = resources.getString(R.string.nc_settings_notifications_declined) binding.ncDiagnoseNotificationPermissionSubtitle.setTextColor( resources.getColor(R.color.nc_darkRed, null) ) + + binding.settingsCallSound.isEnabled = false + binding.settingsCallSound.alpha = DISABLED_ALPHA + binding.settingsMessageSound.isEnabled = false + binding.settingsMessageSound.alpha = DISABLED_ALPHA + binding.settingsNotificationsPermissionWrapper.setOnClickListener { requestPermissions( arrayOf(Manifest.permission.POST_NOTIFICATIONS), diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index 4011b26a9..882e885fb 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -247,46 +247,25 @@ - + + + android:text="@string/nc_diagnose_notification_permission" + android:textSize="@dimen/headline_text_size" /> - - - - - - - - - - - + + + + + + + +