From 1d767d6e3ffd6e201ad9c55ca524aa73019b4f7f Mon Sep 17 00:00:00 2001 From: David Langley Date: Wed, 25 Aug 2021 17:38:12 +0100 Subject: [PATCH] Fix keyword style, preference persistence and add comment to keyword ruleid --- .../src/main/res/color/keyword_foreground_selector.xml | 4 ++-- library/ui-styles/src/main/res/values/styles_keyword.xml | 3 +++ .../java/org/matrix/android/sdk/api/pushrules/RuleIds.kt | 3 +++ .../java/im/vector/app/core/preference/KeywordPreference.kt | 3 --- .../main/res/xml/vector_settings_notification_default.xml | 4 ++++ .../vector_settings_notification_mentions_and_keywords.xml | 6 ++++++ 6 files changed, 18 insertions(+), 5 deletions(-) diff --git a/library/ui-styles/src/main/res/color/keyword_foreground_selector.xml b/library/ui-styles/src/main/res/color/keyword_foreground_selector.xml index bd8eb2f564..339f240246 100644 --- a/library/ui-styles/src/main/res/color/keyword_foreground_selector.xml +++ b/library/ui-styles/src/main/res/color/keyword_foreground_selector.xml @@ -1,5 +1,5 @@ - - + + diff --git a/library/ui-styles/src/main/res/values/styles_keyword.xml b/library/ui-styles/src/main/res/values/styles_keyword.xml index b4aaeb2dda..76e8eb4fc7 100644 --- a/library/ui-styles/src/main/res/values/styles_keyword.xml +++ b/library/ui-styles/src/main/res/values/styles_keyword.xml @@ -7,6 +7,9 @@ @style/TextAppearance.Vector.Body @color/keyword_background_selector @color/keyword_foreground_selector + true @color/keyword_foreground_selector + true + false \ No newline at end of file diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/pushrules/RuleIds.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/pushrules/RuleIds.kt index 83c4a8e90f..5b14e97d5e 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/pushrules/RuleIds.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/api/pushrules/RuleIds.kt @@ -35,6 +35,9 @@ object RuleIds { // Default Content Rules const val RULE_ID_CONTAIN_USER_NAME = ".m.rule.contains_user_name" + // The keywords rule id is not a "real" id in that it does not exist server-side. + // It is used client-side as a placeholder for rendering the keyword push rule setting + // alongside the others. A similar approach and naming is used on Web and iOS. const val RULE_ID_KEYWORDS = "_keywords" // Default Underride Rules diff --git a/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt b/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt index c082860a87..c3377f63f9 100644 --- a/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt +++ b/vector/src/main/java/im/vector/app/core/preference/KeywordPreference.kt @@ -107,9 +107,6 @@ class KeywordPreference : VectorPreference { private fun addChipToGroup(keyword: String, chipGroup: ChipGroup) { val chip = Chip(context, null, R.attr.vctr_keyword_style) chip.text = keyword - chip.isClickable = true - chip.isCheckable = false - chip.isCloseIconVisible = true chipGroup.addView(chip) chip.setOnCloseIconClickListener { diff --git a/vector/src/main/res/xml/vector_settings_notification_default.xml b/vector/src/main/res/xml/vector_settings_notification_default.xml index b743294753..fb565d2230 100644 --- a/vector/src/main/res/xml/vector_settings_notification_default.xml +++ b/vector/src/main/res/xml/vector_settings_notification_default.xml @@ -6,18 +6,22 @@ diff --git a/vector/src/main/res/xml/vector_settings_notification_mentions_and_keywords.xml b/vector/src/main/res/xml/vector_settings_notification_mentions_and_keywords.xml index 0ee24798d4..2de189cf7f 100644 --- a/vector/src/main/res/xml/vector_settings_notification_mentions_and_keywords.xml +++ b/vector/src/main/res/xml/vector_settings_notification_mentions_and_keywords.xml @@ -6,18 +6,22 @@ @@ -26,11 +30,13 @@ android:title="@string/settings_notification_your_keywords">