mirror of
https://github.com/signalapp/Signal-Android.git
synced 2026-04-26 19:56:02 +01:00
Update username UX and UI.
This commit is contained in:
@@ -2015,11 +2015,7 @@ public class ConversationActivity extends PassphraseRequiredActivity
|
||||
});
|
||||
|
||||
mentionsViewModel.getSelectedRecipient().observe(this, recipient -> {
|
||||
String replacementDisplayName = recipient.getDisplayName(this);
|
||||
if (replacementDisplayName.equals(recipient.getDisplayUsername())) {
|
||||
replacementDisplayName = recipient.getUsername().or(replacementDisplayName);
|
||||
}
|
||||
composeText.replaceTextWithMention(replacementDisplayName, recipient.getId());
|
||||
composeText.replaceTextWithMention(recipient.getDisplayName(this), recipient.getId());
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
@@ -394,7 +394,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
if (recipient != null) {
|
||||
conversationBanner.setAvatar(GlideApp.with(context), recipient);
|
||||
|
||||
String title = isSelf ? context.getString(R.string.note_to_self) : recipient.getDisplayName(context);
|
||||
String title = isSelf ? context.getString(R.string.note_to_self) : recipient.getDisplayNameOrUsername(context);
|
||||
conversationBanner.setTitle(title);
|
||||
|
||||
if (recipient.isGroup()) {
|
||||
@@ -411,7 +411,7 @@ public class ConversationFragment extends LoggingFragment {
|
||||
} else if (isSelf) {
|
||||
conversationBanner.setSubtitle(context.getString(R.string.ConversationFragment__you_can_add_notes_for_yourself_in_this_conversation));
|
||||
} else {
|
||||
String subtitle = recipient.getUsername().or(recipient.getE164()).orNull();
|
||||
String subtitle = recipient.getE164().orNull();
|
||||
|
||||
if (subtitle == null || subtitle.equals(title)) {
|
||||
conversationBanner.hideSubtitle();
|
||||
|
||||
@@ -159,7 +159,7 @@ public class ConversationTitleView extends RelativeLayout {
|
||||
}
|
||||
|
||||
private void setIndividualRecipientTitle(Recipient recipient) {
|
||||
final String displayName = recipient.getDisplayName(getContext());
|
||||
final String displayName = recipient.getDisplayNameOrUsername(getContext());
|
||||
this.title.setText(displayName);
|
||||
this.subtitle.setText(null);
|
||||
updateVerifiedSubtitleVisibility();
|
||||
|
||||
@@ -16,7 +16,6 @@ public class MentionViewHolder extends MappingViewHolder<MentionViewState> {
|
||||
|
||||
private final AvatarImageView avatar;
|
||||
private final TextView name;
|
||||
private final TextView username;
|
||||
|
||||
@Nullable private final MentionEventsListener mentionEventsListener;
|
||||
|
||||
@@ -26,14 +25,12 @@ public class MentionViewHolder extends MappingViewHolder<MentionViewState> {
|
||||
|
||||
avatar = findViewById(R.id.mention_recipient_avatar);
|
||||
name = findViewById(R.id.mention_recipient_name);
|
||||
username = findViewById(R.id.mention_recipient_username);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void bind(@NonNull MentionViewState model) {
|
||||
avatar.setRecipient(model.getRecipient());
|
||||
name.setText(model.getName(context));
|
||||
username.setText(model.getUsername());
|
||||
itemView.setOnClickListener(v -> {
|
||||
if (mentionEventsListener != null) {
|
||||
mentionEventsListener.onMentionClicked(model.getRecipient());
|
||||
|
||||
@@ -27,10 +27,6 @@ public final class MentionViewState implements MappingModel<MentionViewState> {
|
||||
return recipient;
|
||||
}
|
||||
|
||||
@NonNull String getUsername() {
|
||||
return Util.emptyIfNull(recipient.getDisplayUsername());
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull MentionViewState newItem) {
|
||||
return recipient.getId().equals(newItem.recipient.getId());
|
||||
|
||||
Reference in New Issue
Block a user