diff --git a/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java index 865f7ed08..c62971f0b 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java +++ b/app/src/main/java/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java @@ -90,17 +90,22 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientF } else if (recipientId != null) { this.recipient = Recipient.live(recipientId); this.recipient.observeForever(this); - name = this.recipient.get().getDisplayName(getContext()); } - if (recipient == null || recipient.get().isRegistered()) { + Recipient recipientSnapshot = recipient != null ? recipient.get() : null; + + if (recipientSnapshot != null && !recipientSnapshot.isResolving()) { + name = recipientSnapshot.getDisplayName(getContext()); + } else { + name = ""; + } + + if (recipientSnapshot == null || recipientSnapshot.isResolving() || recipientSnapshot.isRegistered()) { smsTag.setVisibility(GONE); } else { smsTag.setVisibility(VISIBLE); } - Recipient recipientSnapshot = recipient != null ? recipient.get() : null; - if (recipientSnapshot == null || recipientSnapshot.isResolving()) { this.contactPhotoImage.setAvatar(glideRequests, null, false); setText(null, type, name, number, label, about); @@ -209,6 +214,7 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientF if (this.recipient != null && this.recipient.getId().equals(recipient.getId())) { contactPhotoImage.setAvatar(glideRequests, recipient, false); setText(recipient, contactType, contactName, contactNumber, contactLabel, contactAbout); + smsTag.setVisibility(recipient.isRegistered() ? GONE : VISIBLE); } else { Log.w(TAG, "Bad change! Local recipient doesn't match. Ignoring. Local: " + (this.recipient == null ? "null" : this.recipient.getId()) + ", Changed: " + recipient.getId()); }