Resolve names off Recipient objects in contact selection.

Fixes #3715
// FREEBIE
This commit is contained in:
Moxie Marlinspike 2015-07-21 13:30:29 -07:00
parent 4f75ea0fd0
commit f04281ac4a

View File

@ -1,6 +1,7 @@
package org.thoughtcrime.securesms.contacts; package org.thoughtcrime.securesms.contacts;
import android.content.Context; import android.content.Context;
import android.text.TextUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
import android.view.View; import android.view.View;
import android.widget.CheckBox; import android.widget.CheckBox;
@ -54,8 +55,13 @@ public class ContactSelectionListItem extends RelativeLayout implements Recipien
if (type == ContactsDatabase.NEW_TYPE) { if (type == ContactsDatabase.NEW_TYPE) {
this.recipients = null; this.recipients = null;
this.contactPhotoImage.setAvatar(Recipient.getUnknownRecipient(), false); this.contactPhotoImage.setAvatar(Recipient.getUnknownRecipient(), false);
} else if (number != null) { } else if (!TextUtils.isEmpty(number)) {
this.recipients = RecipientFactory.getRecipientsFromString(getContext(), number, true); this.recipients = RecipientFactory.getRecipientsFromString(getContext(), number, true);
if (this.recipients.getPrimaryRecipient().getName() != null) {
name = this.recipients.getPrimaryRecipient().getName();
}
this.recipients.addListener(this); this.recipients.addListener(this);
} }
@ -114,6 +120,7 @@ public class ContactSelectionListItem extends RelativeLayout implements Recipien
@Override @Override
public void run() { public void run() {
contactPhotoImage.setAvatar(recipients, false); contactPhotoImage.setAvatar(recipients, false);
nameView.setText(recipients.toShortString());
} }
}); });
} }