Fix keyword style, preference persistence and add comment to keyword ruleid

This commit is contained in:
David Langley 2021-08-25 17:38:12 +01:00
parent d7547e2e7e
commit 1d767d6e3f
6 changed files with 18 additions and 5 deletions

View file

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:alpha="0.25" android:color="?attr/colorOnSecondary" android:state_enabled="false" />
<item android:color="?attr/colorOnSecondary" />
<item android:alpha="0.25" android:color="?attr/colorOnPrimary" android:state_enabled="false" />
<item android:color="?attr/colorOnPrimary" />
</selector>

View file

@ -7,6 +7,9 @@
<item name="android:textAppearance">@style/TextAppearance.Vector.Body</item>
<item name="chipBackgroundColor">@color/keyword_background_selector</item>
<item name="closeIconTint">@color/keyword_foreground_selector</item>
<item name="closeIconVisible">true</item>
<item name="android:textColor">@color/keyword_foreground_selector</item>
<item name="android:clickable">true</item>
<item name="android:checkable">false</item>
</style>
</resources>

View file

@ -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

View file

@ -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 {

View file

@ -6,18 +6,22 @@
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_ONE_TO_ONE_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_messages_direct_messages" />
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_ONE_ONE_CHAT_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_encrypted_direct_messages" />
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_GROUP_CHAT_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_group_messages" />
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_MESSAGES_IN_E2E_GROUP_CHAT_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_encrypted_group_messages" />
</im.vector.app.core.preference.VectorPreferenceCategory>

View file

@ -6,18 +6,22 @@
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_CONTAINING_MY_DISPLAY_NAME_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_messages_containing_display_name" />
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_CONTAINING_MY_USER_NAME_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_messages_containing_username" />
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_MESSAGES_CONTAINING_AT_ROOM_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_mentions_at_room" />
<im.vector.app.core.preference.VectorCheckboxPreference
android:key="SETTINGS_PUSH_RULE_MESSAGES_CONTAINING_KEYWORDS_PREFERENCE_KEY"
android:persistent="false"
android:title="@string/settings_messages_containing_keywords" />
</im.vector.app.core.preference.VectorPreferenceCategory>
@ -26,11 +30,13 @@
android:title="@string/settings_notification_your_keywords">
<im.vector.app.core.preference.KeywordPreference
android:key="SETTINGS_KEYWORD_EDIT"
android:persistent="false"
/>
<im.vector.app.core.preference.VectorPreference
android:key="SETTINGS_KEYWORDS_FOOTER"
android:focusable="false"
android:persistent="false"
android:summary="@string/settings_mentions_and_keywords_encryption_notice" />
</im.vector.app.core.preference.VectorPreferenceCategory>