mirror of
https://github.com/oxen-io/session-android.git
synced 2024-12-25 01:07:47 +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.provider.ContactsContract;
|
||||||
import android.support.annotation.Nullable;
|
import android.support.annotation.Nullable;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.ImageView;
|
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.contacts.avatars.ContactPhotoFactory;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
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 boolean inverted;
|
||||||
private OnClickListener listener = null;
|
private OnClickListener listener = null;
|
||||||
|
@ -3,6 +3,7 @@ package org.thoughtcrime.securesms.contacts;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.text.TextUtils;
|
import android.text.TextUtils;
|
||||||
import android.util.AttributeSet;
|
import android.util.AttributeSet;
|
||||||
|
import android.util.Log;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.CheckBox;
|
import android.widget.CheckBox;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
@ -13,10 +14,13 @@ import org.thoughtcrime.securesms.components.AvatarImageView;
|
|||||||
import org.thoughtcrime.securesms.database.Address;
|
import org.thoughtcrime.securesms.database.Address;
|
||||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||||
import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
|
import org.thoughtcrime.securesms.recipients.RecipientModifiedListener;
|
||||||
|
import org.thoughtcrime.securesms.util.Util;
|
||||||
import org.thoughtcrime.securesms.util.ViewUtil;
|
import org.thoughtcrime.securesms.util.ViewUtil;
|
||||||
|
|
||||||
public class ContactSelectionListItem extends LinearLayout implements RecipientModifiedListener {
|
public class ContactSelectionListItem extends LinearLayout implements RecipientModifiedListener {
|
||||||
|
|
||||||
|
private static final String TAG = ContactSelectionListItem.class.getSimpleName();
|
||||||
|
|
||||||
private AvatarImageView contactPhotoImage;
|
private AvatarImageView contactPhotoImage;
|
||||||
private TextView numberView;
|
private TextView numberView;
|
||||||
private TextView nameView;
|
private TextView nameView;
|
||||||
@ -57,12 +61,11 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientM
|
|||||||
} else if (!TextUtils.isEmpty(number)) {
|
} else if (!TextUtils.isEmpty(number)) {
|
||||||
Address address = Address.fromExternal(getContext(), number);
|
Address address = Address.fromExternal(getContext(), number);
|
||||||
this.recipient = Recipient.from(getContext(), address, true);
|
this.recipient = Recipient.from(getContext(), address, true);
|
||||||
|
this.recipient.addListener(this);
|
||||||
|
|
||||||
if (this.recipient.getName() != null) {
|
if (this.recipient.getName() != null) {
|
||||||
name = this.recipient.getName();
|
name = this.recipient.getName();
|
||||||
}
|
}
|
||||||
|
|
||||||
this.recipient.addListener(this);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.nameView.setTextColor(color);
|
this.nameView.setTextColor(color);
|
||||||
@ -116,12 +119,9 @@ public class ContactSelectionListItem extends LinearLayout implements RecipientM
|
|||||||
@Override
|
@Override
|
||||||
public void onModified(final Recipient recipient) {
|
public void onModified(final Recipient recipient) {
|
||||||
if (this.recipient == recipient) {
|
if (this.recipient == recipient) {
|
||||||
this.contactPhotoImage.post(new Runnable() {
|
Util.runOnMain(() -> {
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
contactPhotoImage.setAvatar(recipient, false);
|
contactPhotoImage.setAvatar(recipient, false);
|
||||||
nameView.setText(recipient.toShortString());
|
nameView.setText(recipient.toShortString());
|
||||||
}
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user