diff --git a/src/org/thoughtcrime/securesms/components/AvatarImageView.java b/src/org/thoughtcrime/securesms/components/AvatarImageView.java index 1b2ac07b32..9fea72dbf1 100644 --- a/src/org/thoughtcrime/securesms/components/AvatarImageView.java +++ b/src/org/thoughtcrime/securesms/components/AvatarImageView.java @@ -6,6 +6,7 @@ import android.content.res.TypedArray; import android.provider.ContactsContract; import android.support.annotation.Nullable; import android.util.AttributeSet; +import android.util.Log; import android.view.View; import android.widget.ImageView; @@ -15,7 +16,9 @@ import org.thoughtcrime.securesms.contacts.avatars.ContactColors; import org.thoughtcrime.securesms.contacts.avatars.ContactPhotoFactory; import org.thoughtcrime.securesms.recipients.Recipient; -public class AvatarImageView extends android.support.v7.widget.AppCompatImageView { +public class AvatarImageView extends ImageView { + + private static final String TAG = AvatarImageView.class.getSimpleName(); private boolean inverted; private OnClickListener listener = null; diff --git a/src/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java b/src/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java index 3659eeecee..f7a4881291 100644 --- a/src/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java +++ b/src/org/thoughtcrime/securesms/contacts/ContactSelectionListItem.java @@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.contacts; import android.content.Context; import android.text.TextUtils; import android.util.AttributeSet; +import android.util.Log; import android.view.View; import android.widget.CheckBox; import android.widget.LinearLayout; @@ -13,10 +14,13 @@ import org.thoughtcrime.securesms.components.AvatarImageView; import org.thoughtcrime.securesms.database.Address; import org.thoughtcrime.securesms.recipients.Recipient; import org.thoughtcrime.securesms.recipients.RecipientModifiedListener; +import org.thoughtcrime.securesms.util.Util; import org.thoughtcrime.securesms.util.ViewUtil; public class ContactSelectionListItem extends LinearLayout implements RecipientModifiedListener { + private static final String TAG = ContactSelectionListItem.class.getSimpleName(); + private AvatarImageView contactPhotoImage; private TextView numberView; private TextView nameView; @@ -57,12 +61,11 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientM } else if (!TextUtils.isEmpty(number)) { Address address = Address.fromExternal(getContext(), number); this.recipient = Recipient.from(getContext(), address, true); + this.recipient.addListener(this); if (this.recipient.getName() != null) { name = this.recipient.getName(); } - - this.recipient.addListener(this); } this.nameView.setTextColor(color); @@ -116,12 +119,9 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientM @Override public void onModified(final Recipient recipient) { if (this.recipient == recipient) { - this.contactPhotoImage.post(new Runnable() { - @Override - public void run() { - contactPhotoImage.setAvatar(recipient, false); - nameView.setText(recipient.toShortString()); - } + Util.runOnMain(() -> { + contactPhotoImage.setAvatar(recipient, false); + nameView.setText(recipient.toShortString()); }); } }