From 9f40bfc645f169287dbd791ef645a5bfca8cd210 Mon Sep 17 00:00:00 2001 From: Sagar <85388413+Sagar0-0@users.noreply.github.com> Date: Tue, 22 Apr 2025 20:04:52 +0530 Subject: [PATCH] Replace glyphs in group update messages. --- .../MessageBackupsTypeSelectionScreen.kt | 2 +- .../remote/RemoteBackupsSettingsFragment.kt | 2 +- .../ConversationListItem.java | 35 +- .../model/GroupsV2UpdateMessageProducer.java | 485 +++++++++--------- .../database/model/InMemoryMessageRecord.java | 5 +- .../database/model/LiveUpdateMessage.java | 36 +- .../database/model/MessageRecord.java | 122 ++--- .../database/model/MmsMessageRecord.java | 10 +- .../database/model/UpdateDescription.java | 35 +- .../securesms/fonts/SignalSymbols.kt | 17 +- .../checkable_outline_background.xml | 11 - app/src/main/res/drawable/check.xml | 14 - .../main/res/drawable/checkable_outline.xml | 5 - .../drawable/checkable_outline_background.xml | 4 - .../database/model/UpdateDescriptionTest.java | 28 +- 15 files changed, 390 insertions(+), 421 deletions(-) delete mode 100644 app/src/main/res/drawable-v21/checkable_outline_background.xml delete mode 100644 app/src/main/res/drawable/check.xml delete mode 100644 app/src/main/res/drawable/checkable_outline.xml delete mode 100644 app/src/main/res/drawable/checkable_outline_background.xml diff --git a/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/subscription/MessageBackupsTypeSelectionScreen.kt b/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/subscription/MessageBackupsTypeSelectionScreen.kt index bc8b0a30bb..93d547f8bb 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/subscription/MessageBackupsTypeSelectionScreen.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/backup/v2/ui/subscription/MessageBackupsTypeSelectionScreen.kt @@ -262,7 +262,7 @@ fun MessageBackupsTypeBlock( Text( text = signalSymbolText( text = stringResource(R.string.MessageBackupsTypeSelectionScreen__current_plan), - glyphStart = SignalSymbols.Glyph.CHECKMARK + glyphStart = SignalSymbols.Glyph.CHECK ), color = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt index 3668de79bc..b1f4f915b5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/backups/remote/RemoteBackupsSettingsFragment.kt @@ -687,7 +687,7 @@ private fun BackupCard( Text( text = signalSymbolText( text = title, - glyphStart = if (backupState.isActive()) SignalSymbols.Glyph.CHECKMARK else null + glyphStart = if (backupState.isActive()) SignalSymbols.Glyph.CHECK else null ), color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.bodyMedium diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversationlist/ConversationListItem.java b/app/src/main/java/org/thoughtcrime/securesms/conversationlist/ConversationListItem.java index 872bb620f1..f8f1f45301 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversationlist/ConversationListItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/conversationlist/ConversationListItem.java @@ -72,6 +72,7 @@ import org.thoughtcrime.securesms.database.model.LiveUpdateMessage; import org.thoughtcrime.securesms.database.model.MessageRecord; import org.thoughtcrime.securesms.database.model.ThreadRecord; import org.thoughtcrime.securesms.database.model.UpdateDescription; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Glyph; import org.thoughtcrime.securesms.glide.GlideLiveDataTarget; import org.thoughtcrime.securesms.mms.DecryptableStreamUriLoader; import org.thoughtcrime.securesms.recipients.LiveRecipient; @@ -588,9 +589,9 @@ public final class ConversationListItem extends ConstraintLayout implements Bind return emphasisAdded(context, context.getString(R.string.ThreadRecord_message_request), defaultTint); } } else if (thread.getRecipient().isBlocked() && thread.getRecipient().isGroup()) { - return emphasisAdded(context, context.getString(R.string.ThreadRecord_blocked_group), R.drawable.symbol_block_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_blocked_group), Glyph.BLOCK, defaultTint); } else if (thread.getRecipient().isBlocked()) { - return emphasisAdded(context, context.getString(R.string.ThreadRecord_blocked), R.drawable.symbol_block_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_blocked), Glyph.BLOCK, defaultTint); } else if (MessageTypes.isGroupUpdate(thread.getType())) { if (thread.getRecipient().isPushV2Group()) { if (thread.getMessageExtras() != null) { @@ -599,14 +600,14 @@ public final class ConversationListItem extends ConstraintLayout implements Bind return emphasisAdded(context, MessageRecord.getGv2ChangeDescription(context, thread.getBody(), null), defaultTint); } } else { - return emphasisAdded(context, context.getString(R.string.ThreadRecord_group_updated), R.drawable.ic_update_group_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_group_updated), Glyph.GROUP, defaultTint); } } else if (MessageTypes.isGroupQuit(thread.getType())) { - return emphasisAdded(context, context.getString(R.string.ThreadRecord_left_the_group), R.drawable.ic_update_group_leave_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_left_the_group), Glyph.LEAVE, defaultTint); } else if (MessageTypes.isKeyExchangeType(thread.getType())) { return emphasisAdded(context, context.getString(R.string.ConversationListItem_key_exchange_message), defaultTint); } else if (MessageTypes.isChatSessionRefresh(thread.getType())) { - return emphasisAdded(context, context.getString(R.string.ThreadRecord_chat_session_refreshed), R.drawable.ic_refresh_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_chat_session_refreshed), Glyph.REFRESH, defaultTint); } else if (MessageTypes.isNoRemoteSessionType(thread.getType())) { return emphasisAdded(context, context.getString(R.string.MessageDisplayHelper_message_encrypted_for_non_existing_session), defaultTint); } else if (MessageTypes.isEndSessionType(thread.getType())) { @@ -614,22 +615,22 @@ public final class ConversationListItem extends ConstraintLayout implements Bind } else if (MessageTypes.isLegacyType(thread.getType())) { return emphasisAdded(context, context.getString(R.string.MessageRecord_message_encrypted_with_a_legacy_protocol_version_that_is_no_longer_supported), defaultTint); } else if (thread.isScheduledMessage()) { - return emphasisAdded(context, context.getString(R.string.ThreadRecord_scheduled_message), R.drawable.symbol_calendar_compact_light_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_scheduled_message), Glyph.CALENDAR, defaultTint); } else if (MessageTypes.isDraftMessageType(thread.getType())) { String draftText = context.getString(R.string.ThreadRecord_draft); return emphasisAdded(context, draftText + " " + thread.getBody(), defaultTint); } else if (MessageTypes.isOutgoingAudioCall(thread.getType())) { - return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_outgoing_voice_call) : thread.getBody(), R.drawable.ic_update_audio_call_outgoing_16, defaultTint); + return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_outgoing_voice_call) : thread.getBody(), Glyph.PHONE, defaultTint); } else if (MessageTypes.isOutgoingVideoCall(thread.getType())) { - return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_outgoing_video_call) : thread.getBody(), R.drawable.ic_update_video_call_outgoing_16, defaultTint); + return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_outgoing_video_call) : thread.getBody(), Glyph.VIDEO_CAMERA, defaultTint); } else if (MessageTypes.isIncomingAudioCall(thread.getType())) { - return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_incoming_voice_call) : thread.getBody(), R.drawable.ic_update_audio_call_incoming_16, defaultTint); + return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_incoming_voice_call) : thread.getBody(), Glyph.PHONE, defaultTint); } else if (MessageTypes.isIncomingVideoCall(thread.getType())) { - return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_incoming_video_call) : thread.getBody(), R.drawable.ic_update_video_call_incoming_16, defaultTint); + return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_incoming_video_call) : thread.getBody(), Glyph.VIDEO_CAMERA, defaultTint); } else if (MessageTypes.isMissedAudioCall(thread.getType())) { - return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_missed_voice_call) : thread.getBody(), R.drawable.ic_update_audio_call_missed_16, defaultTint); + return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_missed_voice_call) : thread.getBody(), Glyph.PHONE, defaultTint); } else if (MessageTypes.isMissedVideoCall(thread.getType())) { - return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_missed_video_call) : thread.getBody(), R.drawable.ic_update_video_call_missed_16, defaultTint); + return emphasisAdded(context, StringUtil.isEmpty(thread.getBody()) ? context.getString(R.string.MessageRecord_missed_video_call) : thread.getBody(), Glyph.VIDEO_CAMERA, defaultTint); } else if (MessageTypes.isGroupCall(thread.getType())) { return emphasisAdded(context, MessageRecord.getGroupCallUpdateDescription(context, thread.getBody(), false), defaultTint); } else if (MessageTypes.isJoinedType(thread.getType())) { @@ -637,10 +638,10 @@ public final class ConversationListItem extends ConstraintLayout implements Bind } else if (MessageTypes.isExpirationTimerUpdate(thread.getType())) { int seconds = (int) (thread.getExpiresIn() / 1000); if (seconds <= 0) { - return emphasisAdded(context, context.getString(R.string.ThreadRecord_disappearing_messages_disabled), R.drawable.ic_update_timer_disabled_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_disappearing_messages_disabled), Glyph.TIMER_SLASH, defaultTint); } String time = ExpirationUtil.getExpirationDisplayValue(context, seconds); - return emphasisAdded(context, context.getString(R.string.ThreadRecord_disappearing_message_time_updated_to_s, time), R.drawable.ic_update_timer_16, defaultTint); + return emphasisAdded(context, context.getString(R.string.ThreadRecord_disappearing_message_time_updated_to_s, time), Glyph.TIMER, defaultTint); } else if (MessageTypes.isIdentityUpdate(thread.getType())) { return emphasisAdded(recipientToStringAsync(thread.getRecipient().getId(), r -> { if (r.isGroup()) { @@ -772,11 +773,11 @@ public final class ConversationListItem extends ConstraintLayout implements Bind } private static @NonNull LiveData emphasisAdded(@NonNull Context context, @NonNull String string, @ColorInt int defaultTint) { - return emphasisAdded(context, UpdateDescription.staticDescription(string, 0), defaultTint); + return emphasisAdded(context, UpdateDescription.staticDescription(string, null), defaultTint); } - private static @NonNull LiveData emphasisAdded(@NonNull Context context, @NonNull String string, @DrawableRes int iconResource, @ColorInt int defaultTint) { - return emphasisAdded(context, UpdateDescription.staticDescription(string, iconResource), defaultTint); + private static @NonNull LiveData emphasisAdded(@NonNull Context context, @NonNull String string, @Nullable Glyph glyph, @ColorInt int defaultTint) { + return emphasisAdded(context, UpdateDescription.staticDescription(string, glyph), defaultTint); } private static @NonNull LiveData emphasisAdded(@NonNull Context context, @NonNull UpdateDescription description, @ColorInt int defaultTint) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/GroupsV2UpdateMessageProducer.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/GroupsV2UpdateMessageProducer.java index 6aad8571b5..fcc5aa45d3 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/GroupsV2UpdateMessageProducer.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/GroupsV2UpdateMessageProducer.java @@ -60,6 +60,7 @@ import org.thoughtcrime.securesms.backup.v2.proto.GroupV2MigrationSelfInvitedUpd import org.thoughtcrime.securesms.backup.v2.proto.GroupV2MigrationUpdate; import org.thoughtcrime.securesms.backup.v2.proto.SelfInvitedOtherUserToGroupUpdate; import org.thoughtcrime.securesms.backup.v2.proto.SelfInvitedToGroupUpdate; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Glyph; import org.thoughtcrime.securesms.groups.GV2AccessLevelUtil; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientId; @@ -117,24 +118,24 @@ final class GroupsV2UpdateMessageProducer { } if (selfPending.isPresent()) { - return updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, selfPending.get().addedByAci, R.drawable.ic_update_group_add_16); + return updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, selfPending.get().addedByAci, Glyph.PERSON_PLUS); } if (decryptedGroupChange != null) { ByteString foundingMemberUuid = decryptedGroupChange.editorServiceIdBytes; if (foundingMemberUuid.size() > 0) { if (selfIds.matches(foundingMemberUuid)) { - return updateDescription(context.getString(R.string.MessageRecord_you_created_the_group), R.drawable.ic_update_group_16); + return updateDescription(context.getString(R.string.MessageRecord_you_created_the_group), Glyph.GROUP); } else { - return updateDescription(R.string.MessageRecord_s_added_you, foundingMemberUuid, R.drawable.ic_update_group_add_16); + return updateDescription(R.string.MessageRecord_s_added_you, foundingMemberUuid, Glyph.PERSON_PLUS); } } } if (group != null && DecryptedGroupUtil.findMemberByAci(group.members, selfIds.getAci()).isPresent()) { - return updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), R.drawable.ic_update_group_add_16); + return updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), Glyph.PERSON_PLUS); } else { - return updateDescription(context.getString(R.string.MessageRecord_group_updated), R.drawable.ic_update_group_16); + return updateDescription(context.getString(R.string.MessageRecord_group_updated), Glyph.GROUP); } } @@ -144,7 +145,7 @@ final class GroupsV2UpdateMessageProducer { describeUpdate(update, updates); } if (updates.isEmpty()) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_group_updated), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_group_updated), Glyph.GROUP)); } return updates; @@ -222,9 +223,9 @@ final class GroupsV2UpdateMessageProducer { private void describeGroupSelfInvitationRevokedUpdate(@NonNull GroupSelfInvitationRevokedUpdate update, @NonNull List updates) { if (update.revokerAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_an_admin_revoked_your_invitation_to_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_an_admin_revoked_your_invitation_to_the_group), Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_invitation_to_the_group, update.revokerAci, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_invitation_to_the_group, update.revokerAci, Glyph.PERSON_X)); } } @@ -232,20 +233,20 @@ final class GroupsV2UpdateMessageProducer { final int duration = Math.toIntExact(update.expiresInMs / 1000); String time = ExpirationUtil.getExpirationDisplayValue(context, duration); if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_disappearing_message_time_set_to_s, time), R.drawable.ic_update_timer_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_disappearing_message_time_set_to_s, time), Glyph.TIMER)); } else { boolean editorIsYou = selfIds.matches(update.updaterAci); if (duration <= 0) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_disabled_disappearing_messages), R.drawable.ic_update_timer_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_disabled_disappearing_messages), Glyph.TIMER_SLASH)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_disabled_disappearing_messages, update.updaterAci, R.drawable.ic_update_timer_16)); + updates.add(updateDescription(R.string.MessageRecord_s_disabled_disappearing_messages, update.updaterAci, Glyph.TIMER_SLASH)); } } else { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time), R.drawable.ic_update_timer_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time), Glyph.TIMER)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_set_disappearing_message_time_to_s, update.updaterAci, time, R.drawable.ic_update_timer_16)); + updates.add(updateDescription(R.string.MessageRecord_s_set_disappearing_message_time_to_s, update.updaterAci, time, Glyph.TIMER)); } } } @@ -253,49 +254,49 @@ final class GroupsV2UpdateMessageProducer { private void describeGroupMemberJoinedByLinkUpdate(@NonNull GroupMemberJoinedByLinkUpdate update, @NonNull List updates) { if (selfIds.matches(update.newMemberAci)) { - updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group_via_the_group_link), R.drawable.ic_update_group_accept_16)); + updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group_via_the_group_link), Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group_via_the_group_link, update.newMemberAci, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group_via_the_group_link, update.newMemberAci, Glyph.PERSON_CHECK)); } } private void describeGroupV2MigrationSelfInvitedUpdate(@NonNull GroupV2MigrationSelfInvitedUpdate update, @NonNull List updates) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_couldnt_be_added_to_the_new_group_and_have_been_invited_to_join), R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_couldnt_be_added_to_the_new_group_and_have_been_invited_to_join), Glyph.PERSON_PLUS)); } private void describeGroupV2MigrationDroppedMembersUpdate(@NonNull GroupV2MigrationDroppedMembersUpdate update, @NonNull List updates) { updates.add(updateDescription(context.getResources() - .getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_removed, update.droppedMembersCount, update.droppedMembersCount), R.drawable.ic_update_group_remove_16)); + .getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_removed, update.droppedMembersCount, update.droppedMembersCount), Glyph.PERSON_MINUS)); } private void describeGroupV2MigrationInvitedMembersUpdate(@NonNull GroupV2MigrationInvitedMembersUpdate update, @NonNull List updates) { updates.add(updateDescription(context.getResources() - .getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_invited, update.invitedMembersCount, update.invitedMembersCount), R.drawable.ic_update_group_remove_16)); + .getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_invited, update.invitedMembersCount, update.invitedMembersCount), Glyph.PERSON_MINUS)); } private void describeGroupV2MigrationUpdate(@NonNull GroupV2MigrationUpdate update, @NonNull List updates) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_this_group_was_updated_to_a_new_group), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_this_group_was_updated_to_a_new_group), Glyph.MEGAPHONE)); } private void describeGroupInviteLinkAdminApprovalUpdate(@NonNull GroupInviteLinkAdminApprovalUpdate update, @NonNull List updates) { if (update.updaterAci == null) { if (update.linkRequiresAdminApproval) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_on), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_on), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_off), Glyph.MEGAPHONE)); } } else { if (selfIds.matches(update.updaterAci)) { if (update.linkRequiresAdminApproval) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_admin_approval_for_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_admin_approval_for_the_group_link), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_admin_approval_for_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_admin_approval_for_the_group_link), Glyph.MEGAPHONE)); } } else { if (update.linkRequiresAdminApproval) { - updates.add(updateDescription(R.string.MessageRecord_s_turned_on_admin_approval_for_the_group_link, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_on_admin_approval_for_the_group_link, update.updaterAci, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_turned_off_admin_approval_for_the_group_link, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_off_admin_approval_for_the_group_link, update.updaterAci, Glyph.MEGAPHONE)); } } } @@ -303,12 +304,12 @@ final class GroupsV2UpdateMessageProducer { private void describeInviteLinkDisabledUpdate(@NonNull GroupInviteLinkDisabledUpdate update, @NonNull List updates) { if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_off), Glyph.MEGAPHONE)); } else { if (selfIds.matches(update.updaterAci)) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_the_group_link), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_turned_off_the_group_link, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_off_the_group_link, update.updaterAci, Glyph.MEGAPHONE)); } } } @@ -317,22 +318,22 @@ final class GroupsV2UpdateMessageProducer { if (update.updaterAci == null) { if (update.linkRequiresAdminApproval) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_on), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_on), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_off), Glyph.MEGAPHONE)); } } else { if (selfIds.matches(update.updaterAci)) { if (update.linkRequiresAdminApproval) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_on), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_on), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_off), Glyph.MEGAPHONE)); } } else { if (update.linkRequiresAdminApproval) { - updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_on, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_on, update.updaterAci, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_off, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_off, update.updaterAci, Glyph.MEGAPHONE)); } } } @@ -340,12 +341,12 @@ final class GroupsV2UpdateMessageProducer { private void describeInviteLinkResetUpdate(@NonNull GroupInviteLinkResetUpdate update, @NonNull List updates) { if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_reset), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_reset), Glyph.MEGAPHONE)); } else { if (selfIds.matches(update.updaterAci)) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_reset_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_reset_the_group_link), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_reset_the_group_link, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_reset_the_group_link, update.updaterAci, Glyph.MEGAPHONE)); } } } @@ -354,9 +355,9 @@ final class GroupsV2UpdateMessageProducer { boolean requestingMemberIsYou = selfIds.matches(update.requestorAci); if (requestingMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_canceled_your_request_to_join_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_canceled_your_request_to_join_the_group), Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_canceled_their_request_to_join_the_group, update.requestorAci, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_s_canceled_their_request_to_join_the_group, update.requestorAci, Glyph.PERSON_X)); } } @@ -366,40 +367,40 @@ final class GroupsV2UpdateMessageProducer { if (update.wasApproved) { if (update.updaterAci == null) { if (requestingMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_approved), R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_approved), Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_approved, update.requestorAci, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_approved, update.requestorAci, Glyph.PERSON_CHECK)); } } else { if (requestingMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_approved_your_request_to_join_the_group, update.updaterAci, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_approved_your_request_to_join_the_group, update.updaterAci, Glyph.PERSON_CHECK)); } else { boolean editorIsYou = selfIds.matches(update.updaterAci); if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_approved_a_request_to_join_the_group_from_s, update.requestorAci, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_you_approved_a_request_to_join_the_group_from_s, update.requestorAci, Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_approved_a_request_to_join_the_group_from_s, update.updaterAci, update.requestorAci, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_approved_a_request_to_join_the_group_from_s, update.updaterAci, update.requestorAci, Glyph.PERSON_CHECK)); } } } } else { if (update.updaterAci == null) { if (requestingMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_denied, update.requestorAci, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_denied, update.requestorAci, Glyph.PERSON_X)); } } else { if (requestingMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), Glyph.PERSON_X)); } else { boolean editorIsYou = selfIds.matches(update.updaterAci); if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_denied_a_request_to_join_the_group_from_s, update.requestorAci, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_you_denied_a_request_to_join_the_group_from_s, update.requestorAci, Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_denied_a_request_to_join_the_group_from_s, update.updaterAci, update.requestorAci, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_s_denied_a_request_to_join_the_group_from_s, update.updaterAci, update.requestorAci, Glyph.PERSON_X)); } } } @@ -408,9 +409,9 @@ final class GroupsV2UpdateMessageProducer { private void describeGroupJoinRequestUpdate(@NonNull GroupJoinRequestUpdate update, @NonNull List updates) { if (selfIds.matches(update.requestorAci)) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_sent_a_request_to_join_the_group), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_sent_a_request_to_join_the_group), Glyph.GROUP)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_requested_to_join_via_the_group_link, update.requestorAci, R.drawable.ic_update_group_16)); + updates.add(updateDescription(R.string.MessageRecord_s_requested_to_join_via_the_group_link, update.requestorAci, Glyph.GROUP)); } } @@ -426,28 +427,28 @@ final class GroupsV2UpdateMessageProducer { if (update.updaterAci == null) { if (revokedMeCount > 0) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_an_admin_revoked_your_invitation_to_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_an_admin_revoked_your_invitation_to_the_group), Glyph.PERSON_X)); } if (notMeInvitees > 0) { - updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_invitations_were_revoked, notMeInvitees, notMeInvitees), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_invitations_were_revoked, notMeInvitees, notMeInvitees), Glyph.PERSON_X)); } } else { if (revokedMeCount > 0) { - updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_invitation_to_the_group, update.updaterAci, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_invitation_to_the_group, update.updaterAci, Glyph.PERSON_X)); } if (selfIds.matches(update.updaterAci)) { - updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_you_revoked_invites, notMeInvitees, notMeInvitees), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_you_revoked_invites, notMeInvitees, notMeInvitees), Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.plurals.MessageRecord_s_revoked_invites, notMeInvitees, update.updaterAci, notMeInvitees, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.plurals.MessageRecord_s_revoked_invites, notMeInvitees, update.updaterAci, notMeInvitees, Glyph.PERSON_X)); } } } private void describeGroupInvitationDeclinedUpdate(@NonNull GroupInvitationDeclinedUpdate update, @NonNull List updates) { if (update.inviteeAci != null && selfIds.matches(update.inviteeAci)) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_declined_the_invitation_to_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_declined_the_invitation_to_the_group), Glyph.PERSON_X)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_someone_declined_an_invitation_to_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_someone_declined_an_invitation_to_the_group), Glyph.PERSON_X)); } } @@ -456,24 +457,24 @@ final class GroupsV2UpdateMessageProducer { if (update.updaterAci == null) { if (newMemberIsYou) { - updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, update.newMemberAci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, update.newMemberAci, Glyph.PERSON_PLUS)); } } else { if (newMemberIsYou) { - updates.add(0, updateDescription(R.string.MessageRecord_s_added_you, update.updaterAci, R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(R.string.MessageRecord_s_added_you, update.updaterAci, Glyph.PERSON_PLUS)); } else if (selfIds.matches(update.updaterAci)) { if (update.hadOpenInvitation) { - updates.add(updateDescription(R.string.MessageRecord_you_added_invited_member_s, update.newMemberAci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_you_added_invited_member_s, update.newMemberAci, Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.string.MessageRecord_you_added_s, update.newMemberAci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_you_added_s, update.newMemberAci, Glyph.PERSON_PLUS)); } } else { if (update.hadOpenInvitation) { - updates.add(updateDescription(R.string.MessageRecord_s_added_invited_member_s, update.updaterAci, update.newMemberAci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_invited_member_s, update.updaterAci, update.newMemberAci, Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_added_s, update.updaterAci, update.newMemberAci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_s, update.updaterAci, update.newMemberAci, Glyph.PERSON_PLUS)); } } } @@ -483,75 +484,75 @@ final class GroupsV2UpdateMessageProducer { boolean newMemberIsYou = selfIds.matches(update.newMemberAci); if (newMemberIsYou) { - updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, update.newMemberAci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, update.newMemberAci, Glyph.PERSON_PLUS)); } } private void describeGroupInvitationAcceptedUpdate(@NonNull GroupInvitationAcceptedUpdate update, @NonNull List updates) { if (selfIds.matches(update.newMemberAci)) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_accepted_invite), R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_accepted_invite), Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_accepted_invite, update.newMemberAci, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_accepted_invite, update.newMemberAci, Glyph.PERSON_CHECK)); } } private void describeUnknownUsersInvitedUpdate(@NonNull GroupUnknownInviteeUpdate update, @NonNull List updates) { if (update.inviterAci == null) { - updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_people_were_invited_to_the_group, update.inviteeCount, update.inviteeCount), R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_people_were_invited_to_the_group, update.inviteeCount, update.inviteeCount), Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.plurals.MessageRecord_s_invited_members, update.inviteeCount, update.inviterAci, update.inviteeCount, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.plurals.MessageRecord_s_invited_members, update.inviteeCount, update.inviterAci, update.inviteeCount, Glyph.PERSON_PLUS)); } } private void describeSelfInvitedOtherUserToGroupUpdate(@NonNull SelfInvitedOtherUserToGroupUpdate update, @NonNull List updates) { - updates.add(updateDescription(R.string.MessageRecord_you_invited_s_to_the_group, update.inviteeServiceId, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_you_invited_s_to_the_group, update.inviteeServiceId, Glyph.PERSON_PLUS)); } private void describeSelfInvitedToGroupUpdate(@NonNull SelfInvitedToGroupUpdate update, @NonNull List updates) { if (update.inviterAci == null) { - updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_were_invited_to_the_group), R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_were_invited_to_the_group), Glyph.PERSON_PLUS)); } else { - updates.add(0, updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, update.inviterAci, R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, update.inviterAci, Glyph.PERSON_PLUS)); } } private void describeGenericGroupUpdate(@NonNull GenericGroupUpdate update, @NonNull List updates) { if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_was_updated), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_was_updated), Glyph.GROUP)); } else { boolean editorIsYou = selfIds.matches(update.updaterAci); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_updated_group), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_updated_group), Glyph.GROUP)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_updated_group, update.updaterAci, R.drawable.ic_update_group_16)); + updates.add(updateDescription(R.string.MessageRecord_s_updated_group, update.updaterAci, Glyph.GROUP)); } } } private void describeGroupCreationUpdate(@NonNull GroupCreationUpdate update, @NonNull List updates) { if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_group_updated), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_group_updated), Glyph.GROUP)); } else { if (selfIds.matches(update.updaterAci)) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_created_the_group), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_created_the_group), Glyph.GROUP)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_added_you, update.updaterAci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_you, update.updaterAci, Glyph.PERSON_PLUS)); } } } private void describeGroupNameUpdate(@NonNull GroupNameUpdate update, @NonNull List updates) { if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_name_has_changed_to_s, BidiUtil.isolateBidi(update.newGroupName)), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_name_has_changed_to_s, BidiUtil.isolateBidi(update.newGroupName)), Glyph.EDIT)); } else { String newTitle = BidiUtil.isolateBidi(update.newGroupName); if (selfIds.matches(update.updaterAci)) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_name_to_s, newTitle), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_name_to_s, newTitle), Glyph.EDIT)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_name_to_s, update.updaterAci, newTitle, R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_name_to_s, update.updaterAci, newTitle, Glyph.EDIT)); } } } @@ -562,14 +563,14 @@ final class GroupsV2UpdateMessageProducer { } String accessLevel = GV2AccessLevelUtil.toString(context, backupGv2AccessLevelToGroups(update.accessLevel)); if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_membership_has_been_changed_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_membership_has_been_changed_to_s, accessLevel), Glyph.MEGAPHONE)); } else { boolean editorIsYou = selfIds.matches(update.updaterAci); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_membership_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_membership_to_s, accessLevel), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_membership_to_s, update.updaterAci, accessLevel, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_membership_to_s, update.updaterAci, accessLevel, Glyph.MEGAPHONE)); } } } @@ -580,14 +581,14 @@ final class GroupsV2UpdateMessageProducer { } String accessLevel = GV2AccessLevelUtil.toString(context, backupGv2AccessLevelToGroups(update.accessLevel)); if (update.updaterAci == null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_info_has_been_changed_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_info_has_been_changed_to_s, accessLevel), Glyph.MEGAPHONE)); } else { boolean editorIsYou = selfIds.matches(update.updaterAci); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_info_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_info_to_s, accessLevel), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_info_to_s, update.updaterAci, accessLevel, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_info_to_s, update.updaterAci, accessLevel, Glyph.MEGAPHONE)); } } } @@ -595,24 +596,24 @@ final class GroupsV2UpdateMessageProducer { private void describeGroupAnnouncementOnlyUpdate(@NonNull GroupAnnouncementOnlyChangeUpdate update, @NonNull List updates) { if (update.updaterAci == null) { if (update.isAnnouncementOnly) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_only_admins_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_only_admins_to_send), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_all_members_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_all_members_to_send), Glyph.MEGAPHONE)); } } else { boolean editorIsYou = selfIds.matches(update.updaterAci); if (update.isAnnouncementOnly) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_only_admins_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_only_admins_to_send), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_allow_only_admins_to_send, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_allow_only_admins_to_send, update.updaterAci, Glyph.MEGAPHONE)); } } else { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_all_members_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_all_members_to_send), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_allow_all_members_to_send, update.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_allow_all_members_to_send, update.updaterAci, Glyph.MEGAPHONE)); } } } @@ -624,9 +625,9 @@ final class GroupsV2UpdateMessageProducer { } boolean editorIsYou = selfIds.matches(update.aci); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_left_the_group), R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_left_the_group), Glyph.LEAVE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_left_the_group, update.aci, R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(R.string.MessageRecord_s_left_the_group, update.aci, Glyph.LEAVE)); } } @@ -635,9 +636,9 @@ final class GroupsV2UpdateMessageProducer { boolean removedMemberIsYou = selfIds.matches(update.removedAci); if (removedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_in_the_group), R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_in_the_group), Glyph.LEAVE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_in_the_group, update.removedAci, R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_in_the_group, update.removedAci, Glyph.LEAVE)); } } else { boolean editorIsYou = selfIds.matches(update.removerAci); @@ -646,18 +647,18 @@ final class GroupsV2UpdateMessageProducer { if (editorIsYou) { if (removedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_left_the_group), R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_left_the_group), Glyph.LEAVE)); } else { - updates.add(updateDescription(R.string.MessageRecord_you_removed_s, update.removedAci, R.drawable.ic_update_group_remove_16)); + updates.add(updateDescription(R.string.MessageRecord_you_removed_s, update.removedAci, Glyph.PERSON_MINUS)); } } else { if (removedMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_removed_you_from_the_group, update.removerAci, R.drawable.ic_update_group_remove_16)); + updates.add(updateDescription(R.string.MessageRecord_s_removed_you_from_the_group, update.removerAci, Glyph.PERSON_MINUS)); } else { if (update.removerAci.equals(update.removedAci)) { - updates.add(updateDescription(R.string.MessageRecord_s_left_the_group, update.removedAci, R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(R.string.MessageRecord_s_left_the_group, update.removedAci, Glyph.LEAVE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_removed_s, update.removerAci, update.removedAci, R.drawable.ic_update_group_remove_16)); + updates.add(updateDescription(R.string.MessageRecord_s_removed_s, update.removerAci, update.removedAci, Glyph.PERSON_MINUS)); } } } @@ -757,14 +758,14 @@ final class GroupsV2UpdateMessageProducer { boolean editorIsYou = selfIds.matches(change.editorServiceIdBytes); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_updated_group), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_updated_group), Glyph.GROUP)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_updated_group, change.editorServiceIdBytes, R.drawable.ic_update_group_16)); + updates.add(updateDescription(R.string.MessageRecord_s_updated_group, change.editorServiceIdBytes, Glyph.GROUP)); } } private void describeUnknownEditorUnknownChange(@NonNull List updates) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_was_updated), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_was_updated), Glyph.GROUP)); } private void describeMemberAdditions(@NonNull DecryptedGroupChange change, @NonNull List updates) { @@ -775,18 +776,18 @@ final class GroupsV2UpdateMessageProducer { if (editorIsYou) { if (newMemberIsYou) { - updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group_via_the_group_link), R.drawable.ic_update_group_accept_16)); + updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group_via_the_group_link), Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_you_added_s, member.aciBytes, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_you_added_s, member.aciBytes, Glyph.PERSON_PLUS)); } } else { if (newMemberIsYou) { - updates.add(0, updateDescription(R.string.MessageRecord_s_added_you, change.editorServiceIdBytes, R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(R.string.MessageRecord_s_added_you, change.editorServiceIdBytes, Glyph.PERSON_PLUS)); } else { if (member.aciBytes.equals(change.editorServiceIdBytes)) { - updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group_via_the_group_link, member.aciBytes, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group_via_the_group_link, member.aciBytes, Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_added_s, change.editorServiceIdBytes, member.aciBytes, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_s, change.editorServiceIdBytes, member.aciBytes, Glyph.PERSON_PLUS)); } } } @@ -798,9 +799,9 @@ final class GroupsV2UpdateMessageProducer { boolean newMemberIsYou = selfIds.matches(member.aciBytes); if (newMemberIsYou) { - updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, member.aciBytes, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, member.aciBytes, Glyph.PERSON_PLUS)); } } } @@ -813,18 +814,18 @@ final class GroupsV2UpdateMessageProducer { if (editorIsYou) { if (removedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_left_the_group), R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_left_the_group), Glyph.LEAVE)); } else { - updates.add(updateDescription(R.string.MessageRecord_you_removed_s, member, R.drawable.ic_update_group_remove_16)); + updates.add(updateDescription(R.string.MessageRecord_you_removed_s, member, Glyph.PERSON_MINUS)); } } else { if (removedMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_removed_you_from_the_group, change.editorServiceIdBytes, R.drawable.ic_update_group_remove_16)); + updates.add(updateDescription(R.string.MessageRecord_s_removed_you_from_the_group, change.editorServiceIdBytes, Glyph.PERSON_MINUS)); } else { if (member.equals(change.editorServiceIdBytes)) { - updates.add(updateDescription(R.string.MessageRecord_s_left_the_group, member, R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(R.string.MessageRecord_s_left_the_group, member, Glyph.LEAVE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_removed_s, change.editorServiceIdBytes, member, R.drawable.ic_update_group_remove_16)); + updates.add(updateDescription(R.string.MessageRecord_s_removed_s, change.editorServiceIdBytes, member, Glyph.PERSON_MINUS)); } } } @@ -836,9 +837,9 @@ final class GroupsV2UpdateMessageProducer { boolean removedMemberIsYou = selfIds.matches(member); if (removedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_in_the_group), R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_in_the_group), Glyph.LEAVE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_in_the_group, member, R.drawable.ic_update_group_leave_16)); + updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_in_the_group, member, Glyph.LEAVE)); } } } @@ -850,23 +851,23 @@ final class GroupsV2UpdateMessageProducer { boolean changedMemberIsYou = selfIds.matches(roleChange.aciBytes); if (roleChange.role == Member.Role.ADMINISTRATOR) { if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_made_s_an_admin, roleChange.aciBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_you_made_s_an_admin, roleChange.aciBytes, Glyph.MEGAPHONE)); } else { if (changedMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_made_you_an_admin, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_made_you_an_admin, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_made_s_an_admin, change.editorServiceIdBytes, roleChange.aciBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_made_s_an_admin, change.editorServiceIdBytes, roleChange.aciBytes, Glyph.MEGAPHONE)); } } } else { if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_revoked_admin_privileges_from_s, roleChange.aciBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_you_revoked_admin_privileges_from_s, roleChange.aciBytes, Glyph.MEGAPHONE)); } else { if (changedMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_admin_privileges, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_admin_privileges, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_revoked_admin_privileges_from_s, change.editorServiceIdBytes, roleChange.aciBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_revoked_admin_privileges_from_s, change.editorServiceIdBytes, roleChange.aciBytes, Glyph.MEGAPHONE)); } } } @@ -879,15 +880,15 @@ final class GroupsV2UpdateMessageProducer { if (roleChange.role == Member.Role.ADMINISTRATOR) { if (changedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_now_an_admin), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_now_an_admin), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_is_now_an_admin, roleChange.aciBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_is_now_an_admin, roleChange.aciBytes, Glyph.MEGAPHONE)); } } else { if (changedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_an_admin), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_an_admin), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_an_admin, roleChange.aciBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_an_admin, roleChange.aciBytes, Glyph.MEGAPHONE)); } } } @@ -901,38 +902,38 @@ final class GroupsV2UpdateMessageProducer { if (groupAdminStatusUpdate.wasAdminStatusGranted) { if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_made_s_an_admin, groupAdminStatusUpdate.memberAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_you_made_s_an_admin, groupAdminStatusUpdate.memberAci, Glyph.MEGAPHONE)); } else { if (changedMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_made_you_an_admin, groupAdminStatusUpdate.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_made_you_an_admin, groupAdminStatusUpdate.updaterAci, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_made_s_an_admin, groupAdminStatusUpdate.updaterAci, groupAdminStatusUpdate.memberAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_made_s_an_admin, groupAdminStatusUpdate.updaterAci, groupAdminStatusUpdate.memberAci, Glyph.MEGAPHONE)); } } } else { if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_revoked_admin_privileges_from_s, groupAdminStatusUpdate.memberAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_you_revoked_admin_privileges_from_s, groupAdminStatusUpdate.memberAci, Glyph.MEGAPHONE)); } else { if (changedMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_admin_privileges, groupAdminStatusUpdate.updaterAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_admin_privileges, groupAdminStatusUpdate.updaterAci, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_revoked_admin_privileges_from_s, groupAdminStatusUpdate.updaterAci, groupAdminStatusUpdate.memberAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_revoked_admin_privileges_from_s, groupAdminStatusUpdate.updaterAci, groupAdminStatusUpdate.memberAci, Glyph.MEGAPHONE)); } } } } else { if (groupAdminStatusUpdate.wasAdminStatusGranted) { if (changedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_now_an_admin), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_now_an_admin), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_is_now_an_admin, groupAdminStatusUpdate.memberAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_is_now_an_admin, groupAdminStatusUpdate.memberAci, Glyph.MEGAPHONE)); } } else { if (changedMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_an_admin), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_are_no_longer_an_admin), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_an_admin, groupAdminStatusUpdate.memberAci, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_is_no_longer_an_admin, groupAdminStatusUpdate.memberAci, Glyph.MEGAPHONE)); } } } @@ -946,10 +947,10 @@ final class GroupsV2UpdateMessageProducer { boolean newMemberIsYou = selfIds.matches(invitee.serviceIdBytes); if (newMemberIsYou) { - updates.add(0, updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, change.editorServiceIdBytes, R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, change.editorServiceIdBytes, Glyph.PERSON_PLUS)); } else { if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_invited_s_to_the_group, invitee.serviceIdBytes, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_you_invited_s_to_the_group, invitee.serviceIdBytes, Glyph.PERSON_PLUS)); } else { notYouInviteCount++; } @@ -957,7 +958,7 @@ final class GroupsV2UpdateMessageProducer { } if (notYouInviteCount > 0) { - updates.add(updateDescription(R.plurals.MessageRecord_s_invited_members, notYouInviteCount, change.editorServiceIdBytes, notYouInviteCount, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.plurals.MessageRecord_s_invited_members, notYouInviteCount, change.editorServiceIdBytes, notYouInviteCount, Glyph.PERSON_PLUS)); } } @@ -971,9 +972,9 @@ final class GroupsV2UpdateMessageProducer { UUID uuid = UuidUtil.fromByteStringOrUnknown(invitee.addedByAci); if (UuidUtil.UNKNOWN_UUID.equals(uuid)) { - updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_were_invited_to_the_group), R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(context.getString(R.string.MessageRecord_you_were_invited_to_the_group), Glyph.PERSON_PLUS)); } else { - updates.add(0, updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, invitee.addedByAci, R.drawable.ic_update_group_add_16)); + updates.add(0, updateDescription(R.string.MessageRecord_s_invited_you_to_the_group, invitee.addedByAci, Glyph.PERSON_PLUS)); } } else { notYouInviteCount++; @@ -981,7 +982,7 @@ final class GroupsV2UpdateMessageProducer { } if (notYouInviteCount > 0) { - updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_people_were_invited_to_the_group, notYouInviteCount, notYouInviteCount), R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_people_were_invited_to_the_group, notYouInviteCount, notYouInviteCount), Glyph.PERSON_PLUS)); } } @@ -993,12 +994,12 @@ final class GroupsV2UpdateMessageProducer { boolean decline = invitee.serviceIdBytes.equals(change.editorServiceIdBytes); if (decline) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_declined_the_invitation_to_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_declined_the_invitation_to_the_group), Glyph.PERSON_X)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_someone_declined_an_invitation_to_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_someone_declined_an_invitation_to_the_group), Glyph.PERSON_X)); } } else if (selfIds.matches(invitee.serviceIdBytes)) { - updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_invitation_to_the_group, change.editorServiceIdBytes, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_s_revoked_your_invitation_to_the_group, change.editorServiceIdBytes, Glyph.PERSON_X)); } else { notDeclineCount++; } @@ -1006,9 +1007,9 @@ final class GroupsV2UpdateMessageProducer { if (notDeclineCount > 0) { if (editorIsYou) { - updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_you_revoked_invites, notDeclineCount, notDeclineCount), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_you_revoked_invites, notDeclineCount, notDeclineCount), Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.plurals.MessageRecord_s_revoked_invites, notDeclineCount, change.editorServiceIdBytes, notDeclineCount, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.plurals.MessageRecord_s_revoked_invites, notDeclineCount, change.editorServiceIdBytes, notDeclineCount, Glyph.PERSON_X)); } } } @@ -1020,14 +1021,14 @@ final class GroupsV2UpdateMessageProducer { boolean inviteeWasYou = selfIds.matches(invitee.serviceIdBytes); if (inviteeWasYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_an_admin_revoked_your_invitation_to_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_an_admin_revoked_your_invitation_to_the_group), Glyph.PERSON_X)); } else { notDeclineCount++; } } if (notDeclineCount > 0) { - updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_invitations_were_revoked, notDeclineCount, notDeclineCount), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_d_invitations_were_revoked, notDeclineCount, notDeclineCount), Glyph.PERSON_X)); } } @@ -1040,18 +1041,18 @@ final class GroupsV2UpdateMessageProducer { if (editorIsYou) { if (newMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_accepted_invite), R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_accepted_invite), Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_you_added_invited_member_s, aci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_you_added_invited_member_s, aci, Glyph.PERSON_PLUS)); } } else { if (newMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_added_you, change.editorServiceIdBytes, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_you, change.editorServiceIdBytes, Glyph.PERSON_PLUS)); } else { if (aci.equals(change.editorServiceIdBytes)) { - updates.add(updateDescription(R.string.MessageRecord_s_accepted_invite, aci, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_accepted_invite, aci, Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_added_invited_member_s, change.editorServiceIdBytes, aci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_invited_member_s, change.editorServiceIdBytes, aci, Glyph.PERSON_PLUS)); } } } @@ -1064,9 +1065,9 @@ final class GroupsV2UpdateMessageProducer { boolean newMemberIsYou = selfIds.matches(aci); if (newMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, aci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, aci, Glyph.PERSON_PLUS)); } } } @@ -1077,9 +1078,9 @@ final class GroupsV2UpdateMessageProducer { if (change.newTitle != null) { String newTitle = BidiUtil.isolateBidi(change.newTitle.value_); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_name_to_s, newTitle), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_name_to_s, newTitle), Glyph.EDIT)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_name_to_s, change.editorServiceIdBytes, newTitle, R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_name_to_s, change.editorServiceIdBytes, newTitle, Glyph.EDIT)); } } } @@ -1089,16 +1090,16 @@ final class GroupsV2UpdateMessageProducer { if (change.newDescription != null) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_description), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_description), Glyph.EDIT)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_description, change.editorServiceIdBytes, R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_description, change.editorServiceIdBytes, Glyph.EDIT)); } } } private void describeUnknownEditorNewTitle(@NonNull DecryptedGroupChange change, @NonNull List updates) { if (change.newTitle != null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_name_has_changed_to_s, BidiUtil.isolateBidi(change.newTitle.value_)), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_name_has_changed_to_s, BidiUtil.isolateBidi(change.newTitle.value_)), Glyph.EDIT)); } } @@ -1107,18 +1108,18 @@ final class GroupsV2UpdateMessageProducer { boolean editorIsYou = selfIds.matches(groupDescriptionUpdate.updaterAci); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_description), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_description), Glyph.EDIT)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_description, groupDescriptionUpdate.updaterAci, R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_description, groupDescriptionUpdate.updaterAci, Glyph.EDIT)); } } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_name_has_changed_to_s, BidiUtil.isolateBidi(groupDescriptionUpdate.newDescription)), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_name_has_changed_to_s, BidiUtil.isolateBidi(groupDescriptionUpdate.newDescription)), Glyph.EDIT)); } } private void describeUnknownEditorNewDescription(@NonNull DecryptedGroupChange change, @NonNull List updates) { if (change.newDescription != null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_description_has_changed), R.drawable.ic_update_group_name_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_description_has_changed), Glyph.EDIT)); } } @@ -1127,9 +1128,9 @@ final class GroupsV2UpdateMessageProducer { if (change.newAvatar != null) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_avatar), R.drawable.ic_update_group_avatar_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_avatar), Glyph.PHOTO)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_avatar, change.editorServiceIdBytes, R.drawable.ic_update_group_avatar_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_avatar, change.editorServiceIdBytes, Glyph.PHOTO)); } } } @@ -1139,18 +1140,18 @@ final class GroupsV2UpdateMessageProducer { boolean editorIsYou = selfIds.matches(groupAvatarUpdate.updaterAci); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_avatar), R.drawable.ic_update_group_avatar_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_the_group_avatar), Glyph.PHOTO)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_avatar, groupAvatarUpdate.updaterAci, R.drawable.ic_update_group_avatar_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_the_group_avatar, groupAvatarUpdate.updaterAci, Glyph.PHOTO)); } } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_group_avatar_has_been_changed), R.drawable.ic_update_group_avatar_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_group_avatar_has_been_changed), Glyph.PHOTO)); } } private void describeUnknownEditorNewAvatar(@NonNull DecryptedGroupChange change, @NonNull List updates) { if (change.newAvatar != null) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_group_avatar_has_been_changed), R.drawable.ic_update_group_avatar_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_group_avatar_has_been_changed), Glyph.PHOTO)); } } @@ -1161,16 +1162,16 @@ final class GroupsV2UpdateMessageProducer { final int duration = change.newTimer.duration; if (duration <= 0) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_disabled_disappearing_messages), R.drawable.ic_update_timer_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_disabled_disappearing_messages), Glyph.TIMER_SLASH)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_disabled_disappearing_messages, change.editorServiceIdBytes, R.drawable.ic_update_timer_16)); + updates.add(updateDescription(R.string.MessageRecord_s_disabled_disappearing_messages, change.editorServiceIdBytes, Glyph.TIMER_SLASH)); } } else { String time = ExpirationUtil.getExpirationDisplayValue(context, duration); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time), R.drawable.ic_update_timer_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time), Glyph.TIMER)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_set_disappearing_message_time_to_s, change.editorServiceIdBytes, time, R.drawable.ic_update_timer_16)); + updates.add(updateDescription(R.string.MessageRecord_s_set_disappearing_message_time_to_s, change.editorServiceIdBytes, time, Glyph.TIMER)); } } } @@ -1179,7 +1180,7 @@ final class GroupsV2UpdateMessageProducer { private void describeUnknownEditorNewTimer(@NonNull DecryptedGroupChange change, @NonNull List updates) { if (change.newTimer != null) { String time = ExpirationUtil.getExpirationDisplayValue(context, change.newTimer.duration); - updates.add(updateDescription(context.getString(R.string.MessageRecord_disappearing_message_time_set_to_s, time), R.drawable.ic_update_timer_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_disappearing_message_time_set_to_s, time), Glyph.TIMER)); } } @@ -1189,9 +1190,9 @@ final class GroupsV2UpdateMessageProducer { if (change.newAttributeAccess != AccessControl.AccessRequired.UNKNOWN) { String accessLevel = GV2AccessLevelUtil.toString(context, change.newAttributeAccess); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_info_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_info_to_s, accessLevel), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_info_to_s, change.editorServiceIdBytes, accessLevel, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_info_to_s, change.editorServiceIdBytes, accessLevel, Glyph.MEGAPHONE)); } } } @@ -1199,7 +1200,7 @@ final class GroupsV2UpdateMessageProducer { private void describeUnknownEditorNewAttributeAccess(@NonNull DecryptedGroupChange change, @NonNull List updates) { if (change.newAttributeAccess != AccessControl.AccessRequired.UNKNOWN) { String accessLevel = GV2AccessLevelUtil.toString(context, change.newAttributeAccess); - updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_info_has_been_changed_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_info_has_been_changed_to_s, accessLevel), Glyph.MEGAPHONE)); } } @@ -1209,9 +1210,9 @@ final class GroupsV2UpdateMessageProducer { if (change.newMemberAccess != AccessControl.AccessRequired.UNKNOWN) { String accessLevel = GV2AccessLevelUtil.toString(context, change.newMemberAccess); if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_membership_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_changed_who_can_edit_group_membership_to_s, accessLevel), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_membership_to_s, change.editorServiceIdBytes, accessLevel, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_changed_who_can_edit_group_membership_to_s, change.editorServiceIdBytes, accessLevel, Glyph.MEGAPHONE)); } } } @@ -1219,7 +1220,7 @@ final class GroupsV2UpdateMessageProducer { private void describeUnknownEditorNewMembershipAccess(@NonNull DecryptedGroupChange change, @NonNull List updates) { if (change.newMemberAccess != AccessControl.AccessRequired.UNKNOWN) { String accessLevel = GV2AccessLevelUtil.toString(context, change.newMemberAccess); - updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_membership_has_been_changed_to_s, accessLevel), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_who_can_edit_group_membership_has_been_changed_to_s, accessLevel), Glyph.MEGAPHONE)); } } @@ -1242,15 +1243,15 @@ final class GroupsV2UpdateMessageProducer { groupLinkEnabled = true; if (editorIsYou) { if (previousAccessControl == AccessControl.AccessRequired.ADMINISTRATOR) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_admin_approval_for_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_admin_approval_for_the_group_link), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_off), Glyph.MEGAPHONE)); } } else { if (previousAccessControl == AccessControl.AccessRequired.ADMINISTRATOR) { - updates.add(updateDescription(R.string.MessageRecord_s_turned_off_admin_approval_for_the_group_link, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_off_admin_approval_for_the_group_link, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_off, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_off, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } } break; @@ -1258,32 +1259,32 @@ final class GroupsV2UpdateMessageProducer { groupLinkEnabled = true; if (editorIsYou) { if (previousAccessControl == AccessControl.AccessRequired.ANY) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_admin_approval_for_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_admin_approval_for_the_group_link), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_on), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_on_the_group_link_with_admin_approval_on), Glyph.MEGAPHONE)); } } else { if (previousAccessControl == AccessControl.AccessRequired.ANY) { - updates.add(updateDescription(R.string.MessageRecord_s_turned_on_admin_approval_for_the_group_link, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_on_admin_approval_for_the_group_link, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_on, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_on_the_group_link_with_admin_approval_on, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } } break; case UNSATISFIABLE: if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_turned_off_the_group_link), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_turned_off_the_group_link, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_turned_off_the_group_link, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } break; } if (!groupLinkEnabled && change.newInviteLinkPassword.size() > 0) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_reset_the_group_link), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_reset_the_group_link), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_reset_the_group_link, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_reset_the_group_link, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } } } @@ -1302,25 +1303,25 @@ final class GroupsV2UpdateMessageProducer { switch (change.newInviteLinkAccess) { case ANY: if (previousAccessControl == AccessControl.AccessRequired.ADMINISTRATOR) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_off), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_off), Glyph.MEGAPHONE)); } break; case ADMINISTRATOR: if (previousAccessControl == AccessControl.AccessRequired.ANY) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_on), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_admin_approval_for_the_group_link_has_been_turned_on), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_on), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_on_with_admin_approval_on), Glyph.MEGAPHONE)); } break; case UNSATISFIABLE: - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_off), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_turned_off), Glyph.MEGAPHONE)); break; } if (change.newInviteLinkPassword.size() > 0) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_reset), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_the_group_link_has_been_reset), Glyph.MEGAPHONE)); } } @@ -1331,16 +1332,16 @@ final class GroupsV2UpdateMessageProducer { boolean requestingMemberIsYou = selfIds.matches(member.aciBytes); if (requestingMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_sent_a_request_to_join_the_group), R.drawable.ic_update_group_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_sent_a_request_to_join_the_group), Glyph.GROUP)); } else { if (deleteRequestingUuids.contains(member.aciBytes)) { updates.add(updateDescription(R.plurals.MessageRecord_s_requested_and_cancelled_their_request_to_join_via_the_group_link, change.deleteRequestingMembers.size(), member.aciBytes, change.deleteRequestingMembers.size(), - R.drawable.ic_update_group_16)); + Glyph.GROUP)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_requested_to_join_via_the_group_link, member.aciBytes, R.drawable.ic_update_group_16)); + updates.add(updateDescription(R.string.MessageRecord_s_requested_to_join_via_the_group_link, member.aciBytes, Glyph.GROUP)); } } } @@ -1351,14 +1352,14 @@ final class GroupsV2UpdateMessageProducer { boolean requestingMemberIsYou = selfIds.matches(requestingMember.aciBytes); if (requestingMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_approved_your_request_to_join_the_group, change.editorServiceIdBytes, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_approved_your_request_to_join_the_group, change.editorServiceIdBytes, Glyph.PERSON_CHECK)); } else { boolean editorIsYou = selfIds.matches(change.editorServiceIdBytes); if (editorIsYou) { - updates.add(updateDescription(R.string.MessageRecord_you_approved_a_request_to_join_the_group_from_s, requestingMember.aciBytes, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_you_approved_a_request_to_join_the_group_from_s, requestingMember.aciBytes, Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_approved_a_request_to_join_the_group_from_s, change.editorServiceIdBytes, requestingMember.aciBytes, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_approved_a_request_to_join_the_group_from_s, change.editorServiceIdBytes, requestingMember.aciBytes, Glyph.PERSON_CHECK)); } } } @@ -1369,9 +1370,9 @@ final class GroupsV2UpdateMessageProducer { boolean requestingMemberIsYou = selfIds.matches(requestingMember.aciBytes); if (requestingMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_approved), R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_approved), Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_approved, requestingMember.aciBytes, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_approved, requestingMember.aciBytes, Glyph.PERSON_CHECK)); } } } @@ -1390,17 +1391,17 @@ final class GroupsV2UpdateMessageProducer { if (requestingMemberIsYou) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_canceled_your_request_to_join_the_group), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_canceled_your_request_to_join_the_group), Glyph.PERSON_X)); } else { - updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), Glyph.PERSON_X)); } } else { boolean editorIsCanceledMember = change.editorServiceIdBytes.equals(requestingMember); if (editorIsCanceledMember) { - updates.add(updateDescription(R.string.MessageRecord_s_canceled_their_request_to_join_the_group, requestingMember, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_s_canceled_their_request_to_join_the_group, requestingMember, Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_denied_a_request_to_join_the_group_from_s, change.editorServiceIdBytes, requestingMember, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_s_denied_a_request_to_join_the_group_from_s, change.editorServiceIdBytes, requestingMember, Glyph.PERSON_X)); } } } @@ -1411,9 +1412,9 @@ final class GroupsV2UpdateMessageProducer { boolean requestingMemberIsYou = selfIds.matches(requestingMember); if (requestingMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_your_request_to_join_the_group_has_been_denied_by_an_admin), Glyph.PERSON_X)); } else { - updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_denied, requestingMember, R.drawable.ic_update_group_decline_16)); + updates.add(updateDescription(R.string.MessageRecord_a_request_to_join_the_group_from_s_has_been_denied, requestingMember, Glyph.PERSON_X)); } } } @@ -1423,24 +1424,24 @@ final class GroupsV2UpdateMessageProducer { if (change.newIsAnnouncementGroup == EnabledState.ENABLED) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_only_admins_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_only_admins_to_send), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_allow_only_admins_to_send, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_allow_only_admins_to_send, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } } else if (change.newIsAnnouncementGroup == EnabledState.DISABLED) { if (editorIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_all_members_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_allow_all_members_to_send), Glyph.MEGAPHONE)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_allow_all_members_to_send, change.editorServiceIdBytes, R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(R.string.MessageRecord_s_allow_all_members_to_send, change.editorServiceIdBytes, Glyph.MEGAPHONE)); } } } private void describeUnknownEditorAnnouncementGroupChange(@NonNull DecryptedGroupChange change, @NonNull List updates) { if (change.newIsAnnouncementGroup == EnabledState.ENABLED) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_only_admins_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_only_admins_to_send), Glyph.MEGAPHONE)); } else if (change.newIsAnnouncementGroup == EnabledState.DISABLED) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_all_members_to_send), R.drawable.ic_update_group_role_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_allow_all_members_to_send), Glyph.MEGAPHONE)); } } @@ -1453,18 +1454,18 @@ final class GroupsV2UpdateMessageProducer { if (editorIsYou) { if (newMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_accepted_invite), R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_accepted_invite), Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_you_added_invited_member_s, uuid, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_you_added_invited_member_s, uuid, Glyph.PERSON_PLUS)); } } else { if (newMemberIsYou) { - updates.add(updateDescription(R.string.MessageRecord_s_added_you, change.editorServiceIdBytes, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_you, change.editorServiceIdBytes, Glyph.PERSON_PLUS)); } else { if (uuid.equals(change.editorServiceIdBytes)) { - updates.add(updateDescription(R.string.MessageRecord_s_accepted_invite, uuid, R.drawable.ic_update_group_accept_16)); + updates.add(updateDescription(R.string.MessageRecord_s_accepted_invite, uuid, Glyph.PERSON_CHECK)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_added_invited_member_s, change.editorServiceIdBytes, uuid, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_added_invited_member_s, change.editorServiceIdBytes, uuid, Glyph.PERSON_PLUS)); } } } @@ -1477,20 +1478,20 @@ final class GroupsV2UpdateMessageProducer { boolean newMemberIsYou = selfIds.matches(aci); if (newMemberIsYou) { - updates.add(updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(context.getString(R.string.MessageRecord_you_joined_the_group), Glyph.PERSON_PLUS)); } else { - updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, aci, R.drawable.ic_update_group_add_16)); + updates.add(updateDescription(R.string.MessageRecord_s_joined_the_group, aci, Glyph.PERSON_PLUS)); } } } - private static UpdateDescription updateDescription(@NonNull String string, @DrawableRes int iconResource) { - return UpdateDescription.staticDescription(string, iconResource); + private static UpdateDescription updateDescription(@NonNull String string, Glyph glyph) { + return UpdateDescription.staticDescription(string, glyph); } private UpdateDescription updateDescription(@StringRes int stringRes, @NonNull ByteString serviceId1Bytes, - @DrawableRes int iconResource) + Glyph glyph) { ServiceId serviceId = ServiceId.parseOrUnknown(serviceId1Bytes); RecipientId recipientId = RecipientId.from(serviceId); @@ -1503,13 +1504,13 @@ final class GroupsV2UpdateMessageProducer { return makeRecipientsClickable(context, templateString, recipientIdList, recipientClickHandler); }, - iconResource); + glyph); } private UpdateDescription updateDescription(@StringRes int stringRes, @NonNull ByteString serviceId1Bytes, @NonNull ByteString serviceId2Bytes, - @DrawableRes int iconResource) + Glyph glyph) { ServiceId serviceId1 = ServiceId.parseOrUnknown(serviceId1Bytes); ServiceId serviceId2 = ServiceId.parseOrUnknown(serviceId2Bytes); @@ -1525,14 +1526,14 @@ final class GroupsV2UpdateMessageProducer { return makeRecipientsClickable(context, templateString, recipientIdList, recipientClickHandler); }, - iconResource + glyph ); } private UpdateDescription updateDescription(@StringRes int stringRes, @NonNull ByteString serviceId1Bytes, @NonNull Object formatArg, - @DrawableRes int iconResource) + Glyph glyph) { ServiceId serviceId = ServiceId.parseOrUnknown(serviceId1Bytes); RecipientId recipientId = RecipientId.from(serviceId); @@ -1545,7 +1546,7 @@ final class GroupsV2UpdateMessageProducer { return makeRecipientsClickable(context, templateString, recipientIdList, recipientClickHandler); }, - iconResource + glyph ); } @@ -1553,7 +1554,7 @@ final class GroupsV2UpdateMessageProducer { int quantity, @NonNull ByteString serviceId1Bytes, @NonNull Object formatArg, - @DrawableRes int iconResource) + Glyph glyph) { ServiceId serviceId = ServiceId.parseOrUnknown(serviceId1Bytes); RecipientId recipientId = RecipientId.from(serviceId); @@ -1566,7 +1567,7 @@ final class GroupsV2UpdateMessageProducer { return makeRecipientsClickable(context, templateString, recipientIdList, recipientClickHandler); }, - iconResource + glyph ); } diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/InMemoryMessageRecord.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/InMemoryMessageRecord.java index 187e318ec0..ebd7138790 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/InMemoryMessageRecord.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/InMemoryMessageRecord.java @@ -7,6 +7,7 @@ import androidx.annotation.Nullable; import androidx.annotation.StringRes; import org.thoughtcrime.securesms.R; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Glyph; import org.thoughtcrime.securesms.keyvalue.SignalStore; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientId; @@ -93,7 +94,7 @@ public class InMemoryMessageRecord extends MessageRecord { @Override public @Nullable UpdateDescription getUpdateDisplayBody(@NonNull Context context, @Nullable Consumer recipientClickHandler) { return UpdateDescription.staticDescription(context.getString(R.string.ConversationUpdateItem_hidden_contact_message_to_add_back), - R.drawable.symbol_info_compact_16); + Glyph.INFO); } @Override @@ -122,7 +123,7 @@ public class InMemoryMessageRecord extends MessageRecord { String update = context.getString(R.string.ConversationUpdateItem_the_disappearing_message_time_will_be_set_to_s_when_you_message_them, ExpirationUtil.getExpirationDisplayValue(context, SignalStore.settings().getUniversalExpireTimer())); - return UpdateDescription.staticDescription(update, R.drawable.symbol_timer_compact_24); + return UpdateDescription.staticDescription(update, Glyph.TIMER); } @Override diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/LiveUpdateMessage.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/LiveUpdateMessage.java index d4ef3d0df2..bd6baebdcd 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/LiveUpdateMessage.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/LiveUpdateMessage.java @@ -1,11 +1,6 @@ package org.thoughtcrime.securesms.database.model; import android.content.Context; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.graphics.drawable.ColorDrawable; -import android.graphics.drawable.Drawable; -import android.graphics.drawable.InsetDrawable; import android.text.Spannable; import android.text.SpannableString; import android.text.SpannableStringBuilder; @@ -18,12 +13,13 @@ import androidx.lifecycle.Transformations; import com.annimon.stream.Stream; +import org.thoughtcrime.securesms.fonts.SignalSymbols; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Glyph; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Weight; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientId; -import org.thoughtcrime.securesms.util.ContextUtil; import org.thoughtcrime.securesms.util.SpanUtil; import org.thoughtcrime.securesms.util.ThemeUtil; -import org.thoughtcrime.securesms.util.ViewUtil; import org.thoughtcrime.securesms.util.livedata.LiveDataUtil; import java.util.List; @@ -66,31 +62,25 @@ public final class LiveUpdateMessage { } private static @NonNull SpannableString toSpannable(@NonNull Context context, @NonNull UpdateDescription updateDescription, @NonNull Spannable string, @ColorInt int defaultTint, boolean adjustPosition) { - boolean isDarkTheme = ThemeUtil.isDarkTheme(context); - int drawableResource = updateDescription.getIconResource(); - int tint = isDarkTheme ? updateDescription.getDarkTint() : updateDescription.getLightTint(); + boolean isDarkTheme = ThemeUtil.isDarkTheme(context); + Glyph glyph = updateDescription.getGlyph(); + int tint = isDarkTheme ? updateDescription.getDarkTint() : updateDescription.getLightTint(); if (tint == 0) { tint = defaultTint; } - if (drawableResource == 0) { + if (glyph == null) { return new SpannableString(string); } else { - Drawable drawable = ContextUtil.requireDrawable(context, drawableResource); - drawable.setBounds(0, 0, drawable.getIntrinsicWidth(), drawable.getIntrinsicHeight()); - drawable.setColorFilter(tint, PorterDuff.Mode.SRC_ATOP); + SpannableStringBuilder builder = new SpannableStringBuilder(); + CharSequence glyphChar = SignalSymbols.getSpannedString(context, Weight.REGULAR, glyph, -1); - int insetTop = adjustPosition ? ViewUtil.dpToPx(2) : 0; - InsetDrawable insetDrawable = new InsetDrawable(drawable, 0, insetTop, 0, 0); - insetDrawable.setBounds(0, 0, drawable.getIntrinsicWidth(), insetDrawable.getIntrinsicHeight()); + builder.append(glyphChar); + builder.append(" "); + builder.append(string); - Drawable spaceDrawable = new ColorDrawable(Color.TRANSPARENT); - spaceDrawable.setBounds(0, 0, ViewUtil.dpToPx(8), drawable.getIntrinsicHeight()); - - Spannable stringWithImage = new SpannableStringBuilder().append(SpanUtil.buildImageSpan(drawable)).append(SpanUtil.buildImageSpan(spaceDrawable)).append(string); - - return new SpannableString(SpanUtil.color(tint, stringWithImage)); + return new SpannableString(SpanUtil.color(tint, builder)); } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java index 47416723e2..a345d4854c 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/MessageRecord.java @@ -29,6 +29,7 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.VisibleForTesting; import androidx.annotation.WorkerThread; +import androidx.compose.ui.text.AnnotatedString; import androidx.core.content.ContextCompat; import com.annimon.stream.Stream; @@ -54,6 +55,9 @@ import org.thoughtcrime.securesms.database.model.databaseprotos.SessionSwitchove import org.thoughtcrime.securesms.database.model.databaseprotos.ThreadMergeEvent; import org.thoughtcrime.securesms.emoji.EmojiSource; import org.thoughtcrime.securesms.emoji.JumboEmoji; +import org.thoughtcrime.securesms.fonts.SignalSymbols; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Glyph; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Weight; import org.thoughtcrime.securesms.groups.GroupMigrationMembershipChange; import org.thoughtcrime.securesms.keyvalue.SignalStore; import org.thoughtcrime.securesms.mms.Slide; @@ -193,69 +197,69 @@ public abstract class MessageRecord extends DisplayRecord { return getGv2ChangeDescription(context, getBody(), recipientClickHandler); } } else if (isGroupUpdate() && isOutgoing()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_you_updated_group), R.drawable.ic_update_group_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_you_updated_group), Glyph.GROUP); } else if (isGroupUpdate()) { - return fromRecipient(getFromRecipient(), r -> GroupUtil.getNonV2GroupDescription(context, getBody()).toString(r), R.drawable.ic_update_group_16); + return fromRecipient(getFromRecipient(), r -> GroupUtil.getNonV2GroupDescription(context, getBody()).toString(r), Glyph.GROUP); } else if (isGroupQuit() && isOutgoing()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_left_group), R.drawable.ic_update_group_leave_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_left_group), Glyph.LEAVE); } else if (isGroupQuit()) { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.ConversationItem_group_action_left, r.getDisplayName(context)), R.drawable.ic_update_group_leave_16); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.ConversationItem_group_action_left, r.getDisplayName(context)), Glyph.LEAVE); } else if (isIncomingAudioCall()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_incoming_voice_call), getCallDateString(context)), R.drawable.ic_update_audio_call_incoming_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_incoming_voice_call), getCallDateString(context)), Glyph.PHONE); } else if (isIncomingVideoCall()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_incoming_video_call), getCallDateString(context)), R.drawable.ic_update_video_call_incoming_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_incoming_video_call), getCallDateString(context)), Glyph.VIDEO_CAMERA); } else if (isOutgoingAudioCall()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_outgoing_voice_call), getCallDateString(context)), R.drawable.ic_update_audio_call_outgoing_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_outgoing_voice_call), getCallDateString(context)), Glyph.PHONE); } else if (isOutgoingVideoCall()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_outgoing_video_call), getCallDateString(context)), R.drawable.ic_update_video_call_outgoing_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_outgoing_video_call), getCallDateString(context)), Glyph.VIDEO_CAMERA); } else if (isMissedAudioCall()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_missed_voice_call), getCallDateString(context)), R.drawable.ic_update_audio_call_missed_16, ContextCompat.getColor(context, R.color.core_red_shade), ContextCompat.getColor(context, R.color.core_red)); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_missed_voice_call), getCallDateString(context)), Glyph.PHONE, ContextCompat.getColor(context, R.color.core_red_shade), ContextCompat.getColor(context, R.color.core_red)); } else if (isMissedVideoCall()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_missed_video_call), getCallDateString(context)), R.drawable.ic_update_video_call_missed_16, ContextCompat.getColor(context, R.color.core_red_shade), ContextCompat.getColor(context, R.color.core_red)); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(R.string.MessageRecord_missed_video_call), getCallDateString(context)), Glyph.VIDEO_CAMERA, ContextCompat.getColor(context, R.color.core_red_shade), ContextCompat.getColor(context, R.color.core_red)); } else if (isGroupCall()) { return getGroupCallUpdateDescription(context, getBody(), true); } else if (isJoined()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_s_joined_signal, getFromRecipient().getDisplayName(context)), R.drawable.ic_update_group_add_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_s_joined_signal, getFromRecipient().getDisplayName(context)), Glyph.PERSON_PLUS); } else if (isExpirationTimerUpdate()) { int seconds = (int)(getExpiresIn() / 1000); if (seconds <= 0) { - return isOutgoing() ? staticUpdateDescription(context.getString(R.string.MessageRecord_you_disabled_disappearing_messages), R.drawable.ic_update_timer_disabled_16) - : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_disabled_disappearing_messages, r.getDisplayName(context)), R.drawable.ic_update_timer_disabled_16); + return isOutgoing() ? staticUpdateDescription(context.getString(R.string.MessageRecord_you_disabled_disappearing_messages), Glyph.TIMER_SLASH) + : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_disabled_disappearing_messages, r.getDisplayName(context)), Glyph.TIMER_SLASH); } String time = ExpirationUtil.getExpirationDisplayValue(context, seconds); - return isOutgoing() ? staticUpdateDescription(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time), R.drawable.ic_update_timer_16) - : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_set_disappearing_message_time_to_s, r.getDisplayName(context), time), R.drawable.ic_update_timer_16); + return isOutgoing() ? staticUpdateDescription(context.getString(R.string.MessageRecord_you_set_disappearing_message_time_to_s, time), Glyph.TIMER) + : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_set_disappearing_message_time_to_s, r.getDisplayName(context), time), Glyph.TIMER); } else if (isIdentityUpdate()) { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, r.getDisplayName(context)), R.drawable.ic_update_safety_number_16); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, r.getDisplayName(context)), Glyph.SAFETY_NUMBER); } else if (isIdentityVerified()) { - if (isOutgoing()) return fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified, r.getDisplayName(context)), R.drawable.ic_safety_number_16); - else return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified_from_another_device, r.getDisplayName(context)), R.drawable.ic_safety_number_16); + if (isOutgoing()) return fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified, r.getDisplayName(context)), Glyph.SAFETY_NUMBER); + else return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_verified_from_another_device, r.getDisplayName(context)), Glyph.SAFETY_NUMBER); } else if (isIdentityDefault()) { - if (isOutgoing()) return fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified, r.getDisplayName(context)), R.drawable.ic_update_info_16); - else return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified_from_another_device, r.getDisplayName(context)), R.drawable.ic_update_info_16); + if (isOutgoing()) return fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified, r.getDisplayName(context)), Glyph.INFO); + else return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_you_marked_your_safety_number_with_s_unverified_from_another_device, r.getDisplayName(context)), Glyph.INFO); } else if (isProfileChange()) { return getProfileChangeDescription(context); } else if (isChangeNumber()) { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_changed_their_phone_number, r.getDisplayName(context)), R.drawable.ic_phone_16); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_changed_their_phone_number, r.getDisplayName(context)), Glyph.PHONE); } else if (isReleaseChannelDonationRequest()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_like_this_new_feature_help_support_signal_with_a_one_time_donation), 0); + return staticUpdateDescription(context.getString(R.string.MessageRecord_like_this_new_feature_help_support_signal_with_a_one_time_donation), null); } else if (isEndSession()) { - if (isOutgoing()) return staticUpdateDescription(context.getString(R.string.SmsMessageRecord_secure_session_reset), R.drawable.ic_update_info_16); - else return fromRecipient(getFromRecipient(), r-> context.getString(R.string.SmsMessageRecord_secure_session_reset_s, r.getDisplayName(context)), R.drawable.ic_update_info_16); + if (isOutgoing()) return staticUpdateDescription(context.getString(R.string.SmsMessageRecord_secure_session_reset), Glyph.INFO); + else return fromRecipient(getFromRecipient(), r-> context.getString(R.string.SmsMessageRecord_secure_session_reset_s, r.getDisplayName(context)), Glyph.INFO); } else if (isGroupV1MigrationEvent()) { return getGroupMigrationEventDescription(context); } else if (isChatSessionRefresh()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_chat_session_refreshed), R.drawable.ic_refresh_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_chat_session_refreshed), Glyph.REFRESH); } else if (isBadDecryptType()) { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_a_message_from_s_couldnt_be_delivered, r.getDisplayName(context)), R.drawable.ic_error_outline_14); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_a_message_from_s_couldnt_be_delivered, r.getDisplayName(context)), Glyph.ERROR); } else if (isThreadMergeEventType()) { try { ThreadMergeEvent event = ThreadMergeEvent.ADAPTER.decode(Base64.decodeOrThrow(getBody())); if (event.previousE164.isEmpty()) { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_message_history_with_s_and_another_chat_has_been_merged, r.getDisplayName(context)), R.drawable.ic_thread_merge_16); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_message_history_with_s_and_another_chat_has_been_merged, r.getDisplayName(context)), Glyph.MERGE); } else { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_message_history_with_s_and_their_number_s_has_been_merged, r.getDisplayName(context), SignalE164Util.prettyPrint(event.previousE164)), R.drawable.ic_thread_merge_16); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_message_history_with_s_and_their_number_s_has_been_merged, r.getDisplayName(context), SignalE164Util.prettyPrint(event.previousE164)), Glyph.MERGE); } } catch (IOException e) { throw new AssertionError(e); @@ -265,30 +269,30 @@ public abstract class MessageRecord extends DisplayRecord { SessionSwitchoverEvent event = SessionSwitchoverEvent.ADAPTER.decode(Base64.decodeOrThrow(getBody())); if (event.e164.isEmpty()) { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, r.getDisplayName(context)), R.drawable.ic_update_safety_number_16); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_your_safety_number_with_s_has_changed, r.getDisplayName(context)), Glyph.SAFETY_NUMBER); } else { - return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_belongs_to_s, SignalE164Util.prettyPrint(event.e164), r.getDisplayName(context)), R.drawable.ic_update_info_16); + return fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_s_belongs_to_s, SignalE164Util.prettyPrint(event.e164), r.getDisplayName(context)), Glyph.INFO); } } catch (IOException e) { throw new AssertionError(e); } } else if (isSmsExportType()) { int messageResource = R.string.MessageRecord__you_can_no_longer_send_sms_messages_in_signal; - return fromRecipient(getFromRecipient(), r -> context.getString(messageResource, r.getDisplayName(context)), R.drawable.ic_update_info_16); + return fromRecipient(getFromRecipient(), r -> context.getString(messageResource, r.getDisplayName(context)), Glyph.INFO); } else if (isPaymentsRequestToActivate()) { - return isOutgoing() ? fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_sent_request, r.getShortDisplayName(context)), R.drawable.ic_card_activate_payments) - : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_wants_you_to_activate_payments, r.getShortDisplayName(context)), R.drawable.ic_card_activate_payments); + return isOutgoing() ? fromRecipient(getToRecipient(), r -> context.getString(R.string.MessageRecord_you_sent_request, r.getShortDisplayName(context)), Glyph.ACTIVATE_PAYMENTS) + : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_wants_you_to_activate_payments, r.getShortDisplayName(context)), Glyph.ACTIVATE_PAYMENTS); } else if (isPaymentsActivated()) { - return isOutgoing() ? staticUpdateDescription(context.getString(R.string.MessageRecord_you_activated_payments), R.drawable.ic_card_activate_payments) - : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_can_accept_payments, r.getShortDisplayName(context)), R.drawable.ic_card_activate_payments); + return isOutgoing() ? staticUpdateDescription(context.getString(R.string.MessageRecord_you_activated_payments), Glyph.ACTIVATE_PAYMENTS) + : fromRecipient(getFromRecipient(), r -> context.getString(R.string.MessageRecord_can_accept_payments, r.getShortDisplayName(context)), Glyph.ACTIVATE_PAYMENTS); } else if (isReportedSpam()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_reported_as_spam), R.drawable.symbol_spam_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_reported_as_spam), Glyph.SPAM); } else if (isMessageRequestAccepted()) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_you_accepted_the_message_request), R.drawable.symbol_thread_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_you_accepted_the_message_request), Glyph.THREAD); } else if (isBlocked()) { - return staticUpdateDescription(context.getString(isGroupV2() ? R.string.MessageRecord_you_blocked_this_group : R.string.MessageRecord_you_blocked_this_person), R.drawable.symbol_block_16); + return staticUpdateDescription(context.getString(isGroupV2() ? R.string.MessageRecord_you_blocked_this_group : R.string.MessageRecord_you_blocked_this_person), Glyph.BLOCK); } else if (isUnblocked()) { - return staticUpdateDescription(context.getString(isGroupV2() ? R.string.MessageRecord_you_unblocked_this_group : R.string.MessageRecord_you_unblocked_this_person) , R.drawable.symbol_thread_16); + return staticUpdateDescription(context.getString(isGroupV2() ? R.string.MessageRecord_you_unblocked_this_group : R.string.MessageRecord_you_unblocked_this_person) , Glyph.THREAD); } return null; @@ -352,7 +356,7 @@ public abstract class MessageRecord extends DisplayRecord { return getGv2ChangeDescription(context, decryptedGroupV2Context, recipientClickHandler); } catch (IOException | IllegalArgumentException | IllegalStateException e) { Log.w(TAG, "GV2 Message update detail could not be read", e); - return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), R.drawable.ic_update_group_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), Glyph.GROUP); } } @@ -368,7 +372,7 @@ public abstract class MessageRecord extends DisplayRecord { Log.w(TAG, "GV2 Update Description missing group change update!"); } } - return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), R.drawable.ic_update_group_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), Glyph.GROUP); } public static @NonNull UpdateDescription getGv2ChangeDescription(@NonNull Context context, @NonNull DecryptedGroupV2Context decryptedGroupV2Context, @Nullable Consumer recipientClickHandler) { @@ -386,20 +390,20 @@ public abstract class MessageRecord extends DisplayRecord { } if (selfCreatedGroup(decryptedGroupV2Context.change)) { - newGroupDescriptions.add(staticUpdateDescription(context.getString(R.string.MessageRecord_invite_friends_to_this_group), 0)); + newGroupDescriptions.add(staticUpdateDescription(context.getString(R.string.MessageRecord_invite_friends_to_this_group), null)); } return concatWithNewLinesCapped(context, newGroupDescriptions); } } catch (IllegalArgumentException | IllegalStateException e) { Log.w(TAG, "GV2 Message update detail could not be read", e); - return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), R.drawable.ic_update_group_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), Glyph.GROUP); } } private static @NonNull UpdateDescription concatWithNewLinesCapped(@NonNull Context context, @NonNull List updateDescriptions) { if (updateDescriptions.size() > 100) { // Arbitrary update description collapse cap, otherwise the long string can cause issues - return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), R.drawable.ic_update_group_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_group_updated), Glyph.GROUP); } return UpdateDescription.concatWithNewLines(updateDescriptions); } @@ -437,25 +441,25 @@ public abstract class MessageRecord extends DisplayRecord { protected static @NonNull UpdateDescription fromRecipient(@NonNull Recipient recipient, @NonNull Function stringGenerator, - @DrawableRes int iconResource) + Glyph glyph) { return UpdateDescription.mentioning(Collections.singletonList(recipient.getAci().orElse(ACI.UNKNOWN)), () -> new SpannableString(stringGenerator.apply(recipient.resolve())), - iconResource); + glyph); } protected static @NonNull UpdateDescription staticUpdateDescription(@NonNull String string, - @DrawableRes int iconResource) + Glyph glyph) { - return UpdateDescription.staticDescription(string, iconResource); + return UpdateDescription.staticDescription(string, glyph); } protected static @NonNull UpdateDescription staticUpdateDescription(@NonNull String string, - @DrawableRes int iconResource, + Glyph glyph, @ColorInt int lightTint, @ColorInt int darkTint) { - return UpdateDescription.staticDescription(string, iconResource, lightTint, darkTint); + return UpdateDescription.staticDescription(string, glyph, lightTint, darkTint); } private @NonNull UpdateDescription getProfileChangeDescription(@NonNull Context context) { @@ -486,9 +490,9 @@ public abstract class MessageRecord extends DisplayRecord { updateMessage = context.getString(R.string.MessageRecord_changed_their_profile_name_to, previousName, newName); } - return staticUpdateDescription(updateMessage, R.drawable.ic_update_profile_16); + return staticUpdateDescription(updateMessage, Glyph.PERSON); } else if (profileChangeDetails.deprecatedLearnedProfileName != null) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_started_this_chat, profileChangeDetails.deprecatedLearnedProfileName.previous), R.drawable.symbol_thread_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_started_this_chat, profileChangeDetails.deprecatedLearnedProfileName.previous), Glyph.THREAD); } else if (profileChangeDetails.learnedProfileName != null) { String previouslyKnownAs; if (!Util.isEmpty(profileChangeDetails.learnedProfileName.e164)) { @@ -498,31 +502,31 @@ public abstract class MessageRecord extends DisplayRecord { } if (!Util.isEmpty(previouslyKnownAs)) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_started_this_chat, previouslyKnownAs), R.drawable.symbol_thread_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_started_this_chat, previouslyKnownAs), Glyph.THREAD); } } } - return staticUpdateDescription(context.getString(R.string.MessageRecord_changed_their_profile, getFromRecipient().getDisplayName(context)), R.drawable.ic_update_profile_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_changed_their_profile, getFromRecipient().getDisplayName(context)), Glyph.PERSON); } private UpdateDescription getGroupMigrationEventDescription(@NonNull Context context) { if (Util.isEmpty(getBody())) { - return staticUpdateDescription(context.getString(R.string.MessageRecord_this_group_was_updated_to_a_new_group), R.drawable.ic_update_group_role_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_this_group_was_updated_to_a_new_group), Glyph.MEGAPHONE); } else { GroupMigrationMembershipChange change = getGroupV1MigrationMembershipChanges(); List updates = new ArrayList<>(2); if (change.getPending().size() == 1 && change.getPending().get(0).equals(Recipient.self().getId())) { - updates.add(staticUpdateDescription(context.getString(R.string.MessageRecord_you_couldnt_be_added_to_the_new_group_and_have_been_invited_to_join), R.drawable.ic_update_group_add_16)); + updates.add(staticUpdateDescription(context.getString(R.string.MessageRecord_you_couldnt_be_added_to_the_new_group_and_have_been_invited_to_join), Glyph.PERSON_PLUS)); } else if (change.getPending().size() > 0) { int count = change.getPending().size(); - updates.add(staticUpdateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_invited, count, count), R.drawable.ic_update_group_add_16)); + updates.add(staticUpdateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_invited, count, count), Glyph.PERSON_PLUS)); } if (change.getDropped().size() > 0) { int count = change.getDropped().size(); - updates.add(staticUpdateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_removed, count, count), R.drawable.ic_update_group_remove_16)); + updates.add(staticUpdateDescription(context.getResources().getQuantityString(R.plurals.MessageRecord_members_couldnt_be_added_to_the_new_group_and_have_been_removed, count, count), Glyph.PERSON_MINUS)); } return concatWithNewLinesCapped(context, updates); @@ -540,7 +544,7 @@ public abstract class MessageRecord extends DisplayRecord { UpdateDescription.SpannableFactory stringFactory = new GroupCallUpdateMessageFactory(context, joinedMembers, withTime, groupCallUpdateDetails); - return UpdateDescription.mentioning(joinedMembers, stringFactory, R.drawable.ic_video_16); + return UpdateDescription.mentioning(joinedMembers, stringFactory, Glyph.VIDEO_CAMERA); } public boolean isGroupV2DescriptionUpdate() { diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/MmsMessageRecord.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/MmsMessageRecord.java index c3f35deb42..7090987a3b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/MmsMessageRecord.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/MmsMessageRecord.java @@ -28,6 +28,8 @@ import org.thoughtcrime.securesms.database.model.databaseprotos.BodyRangeList; import org.thoughtcrime.securesms.database.model.databaseprotos.CryptoValue; import org.thoughtcrime.securesms.database.model.databaseprotos.GiftBadge; import org.thoughtcrime.securesms.database.model.databaseprotos.MessageExtras; +import org.thoughtcrime.securesms.fonts.SignalSymbols; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Glyph; import org.thoughtcrime.securesms.linkpreview.LinkPreview; import org.thoughtcrime.securesms.mms.Slide; import org.thoughtcrime.securesms.mms.SlideDeck; @@ -250,20 +252,20 @@ public class MmsMessageRecord extends MessageRecord { if (call.getDirection() == CallTable.Direction.OUTGOING) { if (call.getType() == CallTable.Type.AUDIO_CALL) { int updateString = R.string.MessageRecord_outgoing_voice_call; - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(updateString), callDateString), R.drawable.ic_update_audio_call_outgoing_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(updateString), callDateString), Glyph.PHONE); } else { int updateString = R.string.MessageRecord_outgoing_video_call; - return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(updateString), callDateString), R.drawable.ic_update_video_call_outgoing_16); + return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(updateString), callDateString), Glyph.VIDEO_CAMERA); } } else { boolean isVideoCall = call.getType() == CallTable.Type.VIDEO_CALL; if (accepted || !call.isDisplayedAsMissedCallInUi()) { int updateString = isVideoCall ? R.string.MessageRecord_incoming_video_call : R.string.MessageRecord_incoming_voice_call; - int icon = isVideoCall ? R.drawable.ic_update_video_call_incoming_16 : R.drawable.ic_update_audio_call_incoming_16; + Glyph icon = isVideoCall ? Glyph.VIDEO_CAMERA : Glyph.PHONE; return staticUpdateDescription(context.getString(R.string.MessageRecord_call_message_with_date, context.getString(updateString), callDateString), icon); } else { - int icon = isVideoCall ? R.drawable.ic_update_video_call_missed_16 : R.drawable.ic_update_audio_call_missed_16; + Glyph icon = isVideoCall ? Glyph.VIDEO_CAMERA : Glyph.PHONE; int message; if (call.getEvent() == CallTable.Event.MISSED_NOTIFICATION_PROFILE) { message = isVideoCall ? R.string.MessageRecord_missed_video_call_notification_profile : R.string.MessageRecord_missed_voice_call_notification_profile; diff --git a/app/src/main/java/org/thoughtcrime/securesms/database/model/UpdateDescription.java b/app/src/main/java/org/thoughtcrime/securesms/database/model/UpdateDescription.java index 5cc2923212..51dedfe7d5 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/database/model/UpdateDescription.java +++ b/app/src/main/java/org/thoughtcrime/securesms/database/model/UpdateDescription.java @@ -11,7 +11,8 @@ import androidx.annotation.NonNull; import androidx.annotation.Nullable; import androidx.annotation.WorkerThread; -import org.whispersystems.signalservice.api.push.ServiceId.ACI; +import org.thoughtcrime.securesms.fonts.SignalSymbols; +import org.thoughtcrime.securesms.fonts.SignalSymbols.Glyph; import org.whispersystems.signalservice.api.push.ServiceId; import java.util.Collection; @@ -33,14 +34,14 @@ public final class UpdateDescription { private final Collection mentioned; private final SpannableFactory stringFactory; private final Spannable staticString; - private final int lightIconResource; + private final Glyph glyph; private final int lightTint; private final int darkTint; private UpdateDescription(@NonNull Collection mentioned, @Nullable SpannableFactory stringFactory, @Nullable Spannable staticString, - @DrawableRes int iconResource, + @NonNull Glyph glyph, @ColorInt int lightTint, @ColorInt int darkTint) { @@ -50,7 +51,7 @@ public final class UpdateDescription { this.mentioned = mentioned; this.stringFactory = stringFactory; this.staticString = staticString; - this.lightIconResource = iconResource; + this.glyph = glyph; this.lightTint = lightTint; this.darkTint = darkTint; } @@ -64,43 +65,43 @@ public final class UpdateDescription { */ public static UpdateDescription mentioning(@NonNull Collection mentioned, @NonNull SpannableFactory stringFactory, - @DrawableRes int iconResource) + Glyph glyph) { return new UpdateDescription(mentioned.stream().filter(ServiceId::isValid).collect(Collectors.toList()), stringFactory, null, - iconResource, + glyph, 0, 0); } /** - * Create an update description that's string value is fixed. + * Create an update description that's string value is fixed with a start glyph. */ public static UpdateDescription staticDescription(@NonNull String staticString, - @DrawableRes int iconResource) + Glyph glyph) { - return new UpdateDescription(Collections.emptyList(), null, new SpannableString(staticString), iconResource, 0, 0); + return new UpdateDescription(Collections.emptyList(), null, new SpannableString(staticString), glyph, 0, 0); } /** * Create an update description that's string value is fixed. */ public static UpdateDescription staticDescription(@NonNull Spannable staticString, - @DrawableRes int iconResource) + Glyph glyph) { - return new UpdateDescription(Collections.emptyList(), null, staticString, iconResource, 0, 0); + return new UpdateDescription(Collections.emptyList(), null, staticString, glyph, 0, 0); } /** * Create an update description that's string value is fixed with a specific tint color. */ public static UpdateDescription staticDescription(@NonNull String staticString, - @DrawableRes int iconResource, + Glyph glyph, @ColorInt int lightTint, @ColorInt int darkTint) { - return new UpdateDescription(Collections.emptyList(), null, new SpannableString(staticString), iconResource, lightTint, darkTint); + return new UpdateDescription(Collections.emptyList(), null, new SpannableString(staticString), glyph, lightTint, darkTint); } public boolean isStringStatic() { @@ -131,8 +132,8 @@ public final class UpdateDescription { return mentioned; } - public @DrawableRes int getIconResource() { - return lightIconResource; + public @Nullable Glyph getGlyph() { + return glyph; } public @ColorInt int getLightTint() { @@ -154,7 +155,7 @@ public final class UpdateDescription { if (allAreStatic(updateDescriptions)) { return UpdateDescription.staticDescription(concatStaticLines(updateDescriptions), - updateDescriptions.get(0).getIconResource() + updateDescriptions.get(0).getGlyph() ); } @@ -166,7 +167,7 @@ public final class UpdateDescription { return UpdateDescription.mentioning(allMentioned, () -> concatLines(updateDescriptions), - updateDescriptions.get(0).getIconResource()); + updateDescriptions.get(0).getGlyph()); } private static boolean allAreStatic(@NonNull Collection updateDescriptions) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/fonts/SignalSymbols.kt b/app/src/main/java/org/thoughtcrime/securesms/fonts/SignalSymbols.kt index ac3986c5f5..7aa60187d8 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/fonts/SignalSymbols.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/fonts/SignalSymbols.kt @@ -27,12 +27,6 @@ import org.thoughtcrime.securesms.util.ViewUtil object SignalSymbols { enum class Glyph(val unicode: Char) { - CHECKMARK('\u2713'), - CHEVRON_LEFT('\uE024'), - CHEVRON_RIGHT('\uE025'), - PERSON_CIRCLE('\uE05E'), - LOCK('\uE041'), - LOCK_OPEN('\uE07D'), LOGO('\uE000'), ALBUM('\uE001'), APPEARANCE('\uE031'), @@ -90,6 +84,8 @@ object SignalSymbols { CHECK('\u2713'), CHECK_CIRCLE('\uE022'), CHECK_SQUARE('\uE023'), + CHEVRON_LEFT('\uE024'), + CHEVRON_RIGHT('\uE025'), CHEVRON_UP('\uE026'), CHEVRON_DOWN('\uE027'), CHEVRON_CIRCLE_LEFT('\uE028'), @@ -124,6 +120,8 @@ object SignalSymbols { LINK_ANDROID('\uE03F'), LINK_BROKEN('\uE057'), LINK_SLASH('\uE040'), + LOCK('\uE041'), + LOCK_OPEN('\uE07D'), MEGAPHONE('\uE042'), MERGE('\uE043'), MESSAGE_STATUS_SENDING('\uE044'), @@ -156,6 +154,7 @@ object SignalSymbols { OFFICIAL_BADGE_FILL('\uE087'), OUTGOING('\uE05C'), PERSON('\uE05D'), + PERSON_CIRCLE('\uE05E'), PERSON_CHECK('\uE05F'), PERSON_X('\uE060'), PERSON_PLUS('\uE061'), @@ -187,7 +186,11 @@ object SignalSymbols { VIEW_ONCE_VIEWED('\uE07A'), X('\u00D7'), X_CIRCLE('\u2297'), - X_SQUARE('\u2327') + X_SQUARE('\u2327'), + + REFRESH('\uE000'), + ACTIVATE_PAYMENTS('\uE000'), + CALENDAR('\uE000') } enum class Weight { diff --git a/app/src/main/res/drawable-v21/checkable_outline_background.xml b/app/src/main/res/drawable-v21/checkable_outline_background.xml deleted file mode 100644 index 6593d5db90..0000000000 --- a/app/src/main/res/drawable-v21/checkable_outline_background.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/check.xml b/app/src/main/res/drawable/check.xml deleted file mode 100644 index 1b7224f16e..0000000000 --- a/app/src/main/res/drawable/check.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - \ No newline at end of file diff --git a/app/src/main/res/drawable/checkable_outline.xml b/app/src/main/res/drawable/checkable_outline.xml deleted file mode 100644 index 174159a9a9..0000000000 --- a/app/src/main/res/drawable/checkable_outline.xml +++ /dev/null @@ -1,5 +0,0 @@ - - - - - diff --git a/app/src/main/res/drawable/checkable_outline_background.xml b/app/src/main/res/drawable/checkable_outline_background.xml deleted file mode 100644 index 2a7c3b7f9e..0000000000 --- a/app/src/main/res/drawable/checkable_outline_background.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/app/src/test/java/org/thoughtcrime/securesms/database/model/UpdateDescriptionTest.java b/app/src/test/java/org/thoughtcrime/securesms/database/model/UpdateDescriptionTest.java index 9308ee02b6..07b0845929 100644 --- a/app/src/test/java/org/thoughtcrime/securesms/database/model/UpdateDescriptionTest.java +++ b/app/src/test/java/org/thoughtcrime/securesms/database/model/UpdateDescriptionTest.java @@ -26,28 +26,28 @@ public final class UpdateDescriptionTest { @Test public void staticDescription_byGetStaticString() { - UpdateDescription description = UpdateDescription.staticDescription("update", 0); + UpdateDescription description = UpdateDescription.staticDescription("update", null); assertEquals("update", description.getStaticSpannable().toString()); } @Test public void staticDescription_has_empty_mentions() { - UpdateDescription description = UpdateDescription.staticDescription("update", 0); + UpdateDescription description = UpdateDescription.staticDescription("update", null); assertTrue(description.getMentioned().isEmpty()); } @Test public void staticDescription_byString() { - UpdateDescription description = UpdateDescription.staticDescription("update", 0); + UpdateDescription description = UpdateDescription.staticDescription("update", null); assertEquals("update", description.getSpannable().toString()); } @Test(expected = UnsupportedOperationException.class) public void stringFactory_cannot_call_static_string() { - UpdateDescription description = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), () -> new SpannableString("update"), 0); + UpdateDescription description = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), () -> new SpannableString("update"), null); description.getStaticSpannable(); } @@ -61,7 +61,7 @@ public final class UpdateDescriptionTest { return new SpannableString("update"); }; - UpdateDescription description = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory, 0); + UpdateDescription description = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory, null); assertEquals(0, factoryCalls.get()); @@ -75,7 +75,7 @@ public final class UpdateDescriptionTest { public void stringFactory_reevaluated_on_every_call() { AtomicInteger factoryCalls = new AtomicInteger(); UpdateDescription.SpannableFactory stringFactory = () -> new SpannableString( "call" + factoryCalls.incrementAndGet()); - UpdateDescription description = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory, 0); + UpdateDescription description = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory, null); assertEquals("call1", description.getSpannable().toString()); assertEquals("call2", description.getSpannable().toString()); @@ -84,8 +84,8 @@ public final class UpdateDescriptionTest { @Test public void concat_static_lines() { - UpdateDescription description1 = UpdateDescription.staticDescription("update1", 0); - UpdateDescription description2 = UpdateDescription.staticDescription("update2", 0); + UpdateDescription description1 = UpdateDescription.staticDescription("update1", null); + UpdateDescription description2 = UpdateDescription.staticDescription("update2", null); UpdateDescription description = UpdateDescription.concatWithNewLines(Arrays.asList(description1, description2)); @@ -96,7 +96,7 @@ public final class UpdateDescriptionTest { @Test public void concat_single_does_not_make_new_object() { - UpdateDescription description = UpdateDescription.staticDescription("update1", 0); + UpdateDescription description = UpdateDescription.staticDescription("update1", null); UpdateDescription concat = UpdateDescription.concatWithNewLines(Collections.singletonList(description)); @@ -109,8 +109,8 @@ public final class UpdateDescriptionTest { AtomicInteger factoryCalls2 = new AtomicInteger(); UpdateDescription.SpannableFactory stringFactory1 = () -> new SpannableString("update." + factoryCalls1.incrementAndGet()); UpdateDescription.SpannableFactory stringFactory2 = () -> new SpannableString("update." + factoryCalls2.incrementAndGet()); - UpdateDescription description1 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory1, 0); - UpdateDescription description2 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory2, 0); + UpdateDescription description1 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory1, null); + UpdateDescription description2 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory2, null); factoryCalls1.set(10); factoryCalls2.set(20); @@ -130,9 +130,9 @@ public final class UpdateDescriptionTest { AtomicInteger factoryCalls2 = new AtomicInteger(); UpdateDescription.SpannableFactory stringFactory1 = () -> new SpannableString("update." + factoryCalls1.incrementAndGet()); UpdateDescription.SpannableFactory stringFactory2 = () -> new SpannableString("update." + factoryCalls2.incrementAndGet()); - UpdateDescription description1 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory1, 0); - UpdateDescription description2 = UpdateDescription.staticDescription("static", 0); - UpdateDescription description3 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory2, 0); + UpdateDescription description1 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory1, null); + UpdateDescription description2 = UpdateDescription.staticDescription("static", null); + UpdateDescription description3 = UpdateDescription.mentioning(Collections.singletonList(ACI.from(UUID.randomUUID())), stringFactory2, null); factoryCalls1.set(100); factoryCalls2.set(200);