Fix main thread recipient resolve in contact selection.

fork-5.53.8
Cody Henthorne 2021-06-16 13:32:15 -04:00
rodzic 8be659c1c8
commit 263ddb0d1e
1 zmienionych plików z 16 dodań i 7 usunięć

Wyświetl plik

@ -38,6 +38,10 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientF
private String number;
private String chipName;
private int contactType;
private String contactName;
private String contactNumber;
private String contactLabel;
private String contactAbout;
private LiveRecipient recipient;
private GlideRequests glideRequests;
@ -74,6 +78,10 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientF
this.glideRequests = glideRequests;
this.number = number;
this.contactType = type;
this.contactName = name;
this.contactNumber = number;
this.contactLabel = label;
this.contactAbout = about;
if (type == ContactRepository.NEW_PHONE_TYPE || type == ContactRepository.NEW_USERNAME_TYPE) {
this.recipient = null;
@ -88,9 +96,13 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientF
this.nameView.setTextColor(color);
this.numberView.setTextColor(color);
this.contactPhotoImage.setAvatar(glideRequests, recipientSnapshot, false);
setText(recipientSnapshot, type, name, number, label, about);
if (recipientSnapshot == null || recipientSnapshot.isResolving()) {
this.contactPhotoImage.setAvatar(glideRequests, null, false);
setText(null, type, name, number, label, about);
} else {
this.contactPhotoImage.setAvatar(glideRequests, recipientSnapshot, false);
setText(recipientSnapshot, type, name, number, label, about);
}
this.checkBox.setVisibility(checkboxVisible ? View.VISIBLE : View.GONE);
}
@ -178,9 +190,6 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientF
@Override
public void onRecipientChanged(@NonNull Recipient recipient) {
contactPhotoImage.setAvatar(glideRequests, recipient, false);
nameView.setText(recipient);
if (recipient.isGroup()) {
numberView.setText(getGroupMemberCount(recipient));
}
setText(recipient, contactType, contactName, contactNumber, contactLabel, contactAbout);
}
}