refactor: only display notification settings when the conversation is unmuted, notify the conversation list listeners when notify settings are updated

This commit is contained in:
Harris 2021-07-26 14:50:43 +10:00
parent 0d0089e3d6
commit 2becf9fabe
6 changed files with 9 additions and 9 deletions

View File

@ -92,6 +92,7 @@ object ConversationMenuHelper {
inflater.inflate(R.menu.menu_conversation_muted, menu) inflater.inflate(R.menu.menu_conversation_muted, menu)
} else { } else {
inflater.inflate(R.menu.menu_conversation_unmuted, menu) inflater.inflate(R.menu.menu_conversation_unmuted, menu)
inflater.inflate(R.menu.menu_conversation_notification_settings, menu)
} }
// Search // Search

View File

@ -237,6 +237,7 @@ public class RecipientDatabase extends Database {
values.put(NOTIFY_TYPE, notifyType); values.put(NOTIFY_TYPE, notifyType);
updateOrInsert(recipient.getAddress(), values); updateOrInsert(recipient.getAddress(), values);
recipient.resolve().setNotifyType(notifyType); recipient.resolve().setNotifyType(notifyType);
notifyConversationListListeners();
} }
public void setExpireMessages(@NonNull Recipient recipient, int expiration) { public void setExpireMessages(@NonNull Recipient recipient, int expiration) {

View File

@ -59,7 +59,7 @@ public class ConversationOptionsBottomSheet : BottomSheetDialogFragment(), View.
muteNotificationsTextView.isVisible = !recipient.isMuted && !recipient.isLocalNumber muteNotificationsTextView.isVisible = !recipient.isMuted && !recipient.isLocalNumber
unMuteNotificationsTextView.setOnClickListener(this) unMuteNotificationsTextView.setOnClickListener(this)
muteNotificationsTextView.setOnClickListener(this) muteNotificationsTextView.setOnClickListener(this)
notificationsTextView.isVisible = recipient.isGroupRecipient notificationsTextView.isVisible = recipient.isGroupRecipient && !recipient.isMuted
notificationsTextView.setOnClickListener(this) notificationsTextView.setOnClickListener(this)
deleteTextView.setOnClickListener(this) deleteTextView.setOnClickListener(this)
} }

View File

@ -13,8 +13,4 @@
android:title="@string/conversation__menu_leave_group" android:title="@string/conversation__menu_leave_group"
app:showAsAction="collapseActionView"/> app:showAsAction="collapseActionView"/>
<item
android:title="@string/RecipientPreferenceActivity_notification_settings"
android:id="@+id/menu_notification_settings"/>
</menu> </menu>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:title="@string/RecipientPreferenceActivity_notification_settings"
android:id="@+id/menu_notification_settings"/>
</menu>

View File

@ -6,8 +6,4 @@
android:title="@string/ConversationActivity_invite_to_open_group" android:title="@string/ConversationActivity_invite_to_open_group"
android:id="@+id/menu_invite_to_open_group" /> android:id="@+id/menu_invite_to_open_group" />
<item
android:title="@string/RecipientPreferenceActivity_notification_settings"
android:id="@+id/menu_notification_settings"/>
</menu> </menu>