mirror of
https://github.com/oxen-io/session-android.git
synced 2025-10-16 13:43:07 +00:00
Display a generated avatar icon rather than a single default.
If the contact doesn't have an image, render a color-coded background and the first letter of the contact's name. 1) Don't display anything during recipient resolution. 2) Display a # icon in material gray for recipients with no name. 3) Display a material group icon in material gray for groups with no avatar icon set. Closes #3104 // FREEBIE
This commit is contained in:
@@ -22,16 +22,16 @@ import android.graphics.Typeface;
|
||||
import android.os.Handler;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.thoughtcrime.securesms.components.AvatarImageView;
|
||||
import org.thoughtcrime.securesms.components.FromTextView;
|
||||
import org.thoughtcrime.securesms.database.model.ThreadRecord;
|
||||
import org.thoughtcrime.securesms.recipients.Recipient;
|
||||
import org.thoughtcrime.securesms.recipients.Recipients;
|
||||
import org.thoughtcrime.securesms.util.DateUtils;
|
||||
import org.thoughtcrime.securesms.util.Emoji;
|
||||
import org.thoughtcrime.securesms.util.RecipientViewUtil;
|
||||
|
||||
import java.util.Locale;
|
||||
import java.util.Set;
|
||||
@@ -53,15 +53,15 @@ public class ConversationListItem extends RelativeLayout
|
||||
private final static Typeface BOLD_TYPEFACE = Typeface.create("sans-serif", Typeface.BOLD);
|
||||
private final static Typeface LIGHT_TYPEFACE = Typeface.create("sans-serif-light", Typeface.NORMAL);
|
||||
|
||||
private Context context;
|
||||
private Set<Long> selectedThreads;
|
||||
private Recipients recipients;
|
||||
private long threadId;
|
||||
private TextView subjectView;
|
||||
private TextView fromView;
|
||||
private TextView dateView;
|
||||
private boolean read;
|
||||
private ImageView contactPhotoImage;
|
||||
private Context context;
|
||||
private Set<Long> selectedThreads;
|
||||
private Recipients recipients;
|
||||
private long threadId;
|
||||
private TextView subjectView;
|
||||
private FromTextView fromView;
|
||||
private TextView dateView;
|
||||
private boolean read;
|
||||
private AvatarImageView contactPhotoImage;
|
||||
|
||||
private final Handler handler = new Handler();
|
||||
private int distributionType;
|
||||
@@ -79,10 +79,9 @@ public class ConversationListItem extends RelativeLayout
|
||||
@Override
|
||||
protected void onFinishInflate() {
|
||||
this.subjectView = (TextView) findViewById(R.id.subject);
|
||||
this.fromView = (TextView) findViewById(R.id.from);
|
||||
this.fromView = (FromTextView) findViewById(R.id.from);
|
||||
this.dateView = (TextView) findViewById(R.id.date);
|
||||
|
||||
this.contactPhotoImage = (ImageView) findViewById(R.id.contact_photo_image);
|
||||
this.contactPhotoImage = (AvatarImageView) findViewById(R.id.contact_photo_image);
|
||||
|
||||
initializeContactWidgetVisibility();
|
||||
}
|
||||
@@ -95,7 +94,7 @@ public class ConversationListItem extends RelativeLayout
|
||||
this.distributionType = thread.getDistributionType();
|
||||
|
||||
this.recipients.addListener(this);
|
||||
this.fromView.setText(RecipientViewUtil.formatFrom(context, recipients, read));
|
||||
this.fromView.setText(recipients, read);
|
||||
|
||||
this.subjectView.setText(Emoji.getInstance(context).emojify(thread.getDisplayBody(),
|
||||
Emoji.EMOJI_SMALL,
|
||||
@@ -110,7 +109,7 @@ public class ConversationListItem extends RelativeLayout
|
||||
}
|
||||
|
||||
setBackground(read, batchMode);
|
||||
RecipientViewUtil.setContactPhoto(context, contactPhotoImage, recipients.getPrimaryRecipient(), true);
|
||||
this.contactPhotoImage.setAvatar(recipients.getPrimaryRecipient(), true);
|
||||
}
|
||||
|
||||
public void unbind() {
|
||||
@@ -157,8 +156,8 @@ public class ConversationListItem extends RelativeLayout
|
||||
handler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
ConversationListItem.this.fromView.setText(RecipientViewUtil.formatFrom(context, recipients, read));
|
||||
RecipientViewUtil.setContactPhoto(context, contactPhotoImage, recipients.getPrimaryRecipient(), true);
|
||||
fromView.setText(recipients, read);
|
||||
contactPhotoImage.setAvatar(recipients.getPrimaryRecipient(), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user