mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-24 08:47:46 +00:00
Fixed avatar icons not rendering in contact selection view
// FREEBIE
This commit is contained in:
parent
0a3ede7c32
commit
99b2149deb
@ -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;
|
||||
|
@ -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() {
|
||||
Util.runOnMain(() -> {
|
||||
contactPhotoImage.setAvatar(recipient, false);
|
||||
nameView.setText(recipient.toShortString());
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user