diff --git a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/RemovePushRuleTask.kt b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/RemovePushRuleTask.kt index fc06098278..bae893608b 100644 --- a/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/RemovePushRuleTask.kt +++ b/matrix-sdk-android/src/main/java/org/matrix/android/sdk/internal/session/pushers/RemovePushRuleTask.kt @@ -16,7 +16,6 @@ package org.matrix.android.sdk.internal.session.pushers import org.matrix.android.sdk.api.pushrules.RuleKind -import org.matrix.android.sdk.api.pushrules.rest.PushRule import org.matrix.android.sdk.internal.network.GlobalErrorReceiver import org.matrix.android.sdk.internal.network.executeRequest import org.matrix.android.sdk.internal.task.Task 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 10b02cc088..c082860a87 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 @@ -92,7 +92,7 @@ class KeywordPreference : VectorPreference { return@setOnEditorActionListener false } val keyword = chipEditText.text.toString().trim() - if (keyword.isEmpty()){ + if (keyword.isEmpty()) { return@setOnEditorActionListener false } _keywords.add(keyword) @@ -102,7 +102,6 @@ class KeywordPreference : VectorPreference { chipEditText.text = null return@setOnEditorActionListener true } - } private fun addChipToGroup(keyword: String, chipGroup: ChipGroup) { @@ -114,8 +113,9 @@ class KeywordPreference : VectorPreference { chipGroup.addView(chip) chip.setOnCloseIconClickListener { - if (!keywordsEnabled) + if (!keywordsEnabled) { return@setOnCloseIconClickListener + } _keywords.remove(keyword) listener?.didRemoveKeyword(keyword) onPreferenceChangeListener?.onPreferenceChange(this, _keywords) diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/PushRuleDefinitions.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/PushRuleDefinitions.kt index cfa082c8c0..d101d86aa3 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/PushRuleDefinitions.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/PushRuleDefinitions.kt @@ -87,7 +87,7 @@ fun getStandardAction(ruleId: String, index: NotificationIndex): StandardActions NotificationIndex.NOISY -> StandardActions.Highlight } RuleIds.RULE_ID_KEYWORDS -> - when(index) { + when (index) { NotificationIndex.OFF -> StandardActions.Disabled NotificationIndex.SILENT -> StandardActions.Notify NotificationIndex.NOISY -> StandardActions.HighlightDefaultSound diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt index 777cd0b2d1..3fc6293e6b 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsDefaultNotificationPreferenceFragment.kt @@ -16,9 +16,7 @@ package im.vector.app.features.settings.notifications -import androidx.preference.PreferenceCategory import im.vector.app.R -import im.vector.app.core.preference.VectorCheckboxPreference import im.vector.app.core.preference.VectorPreferenceCategory import org.matrix.android.sdk.api.pushrules.RuleIds diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsKeywordAndMentionsNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsKeywordAndMentionsNotificationPreferenceFragment.kt index e444878168..71daaadc15 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsKeywordAndMentionsNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsKeywordAndMentionsNotificationPreferenceFragment.kt @@ -23,6 +23,7 @@ import androidx.preference.Preference import im.vector.app.R import im.vector.app.core.preference.KeywordPreference import im.vector.app.core.preference.VectorCheckboxPreference +import im.vector.app.core.preference.VectorPreference import im.vector.app.core.preference.VectorPreferenceCategory import im.vector.app.core.utils.toast import kotlinx.coroutines.Dispatchers @@ -63,11 +64,14 @@ class VectorSettingsKeywordAndMentionsNotificationPreferenceFragment keywordPreference.isIconSpaceReserved = false keywordPreference.isChecked = anyEnabledKeywords + val footerPreference = findPreference("SETTINGS_KEYWORDS_FOOTER")!! + footerPreference.isIconSpaceReserved = false + keywordPreference.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> val keywords = editKeywordPreference.keywords val newChecked = newValue as Boolean displayLoadingView() - updateKeywordPushRules(keywords, newChecked){ result -> + updateKeywordPushRules(keywords, newChecked) { result -> hideLoadingView() if (!isAdded) { return@updateKeywordPushRules @@ -95,7 +99,6 @@ class VectorSettingsKeywordAndMentionsNotificationPreferenceFragment scrollToPreference(editKeywordPreference) } } - } fun updateKeywordPushRules(keywords: Set, checked: Boolean, completion: (Result) -> Unit) { @@ -116,7 +119,7 @@ class VectorSettingsKeywordAndMentionsNotificationPreferenceFragment } } val firstError = results.firstNotNullOfOrNull(Result::exceptionOrNull) - if (firstError == null){ + if (firstError == null) { completion(Result.success(Unit)) } else { completion(Result.failure(firstError)) @@ -124,7 +127,7 @@ class VectorSettingsKeywordAndMentionsNotificationPreferenceFragment } } - fun updateWithKeywords (keywords: Set) { + fun updateWithKeywords(keywords: Set) { val editKeywordPreference = findPreference("SETTINGS_KEYWORD_EDIT") ?: return editKeywordPreference.keywords = keywords } diff --git a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt index 0f7ea70121..2b90baf3ba 100644 --- a/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt +++ b/vector/src/main/java/im/vector/app/features/settings/notifications/VectorSettingsPushRuleNotificationPreferenceFragment.kt @@ -43,7 +43,7 @@ abstract class VectorSettingsPushRuleNotificationPreferenceFragment val initialIndex = ruleAndKind.pushRule.notificationIndex preference.isChecked = initialIndex != NotificationIndex.OFF preference.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue -> - updatePushRule(ruleAndKind.pushRule.ruleId, ruleAndKind.kind,newValue as Boolean, preference) + updatePushRule(ruleAndKind.pushRule.ruleId, ruleAndKind.kind, newValue as Boolean, preference) false } } diff --git a/vector/src/main/res/layout/vector_preference_chip_group.xml b/vector/src/main/res/layout/vector_preference_chip_group.xml index 7799d95f0a..33cf6dcf37 100644 --- a/vector/src/main/res/layout/vector_preference_chip_group.xml +++ b/vector/src/main/res/layout/vector_preference_chip_group.xml @@ -38,7 +38,8 @@ android:layout_marginStart="@dimen/layout_horizontal_margin" android:layout_marginEnd="@dimen/layout_horizontal_margin" app:chipSpacing="12dp" - app:lineSpacing="2dp"/> + android:paddingTop="16dp" + /> diff --git a/vector/src/main/res/values/strings.xml b/vector/src/main/res/values/strings.xml index ceeeb4c5f7..c911f1c174 100644 --- a/vector/src/main/res/values/strings.xml +++ b/vector/src/main/res/values/strings.xml @@ -1227,6 +1227,7 @@ Call invitations Messages by bot Room upgrades + You won’t get notifications for mentions & keywords in encrypted rooms on mobile. Background synchronization Background Sync Mode 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 fd81d74755..0ee24798d4 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 @@ -28,5 +28,10 @@ android:key="SETTINGS_KEYWORD_EDIT" /> + + \ No newline at end of file