Update SMS tag visibility in onRecipientChanged.

fork-5.53.8
Alex Hart 2021-07-19 09:05:04 -03:00 zatwierdzone przez Greyson Parrelli
rodzic 8004565c84
commit 167a691018
1 zmienionych plików z 10 dodań i 4 usunięć

Wyświetl plik

@ -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());
}