Add indicator for system contacts.

This commit is contained in:
Greyson Parrelli
2020-07-14 07:37:09 -07:00
committed by GitHub
parent 325e0c6781
commit d1b61bfed3
10 changed files with 142 additions and 21 deletions

View File

@@ -54,15 +54,15 @@ public class ConversationTitleView extends RelativeLayout {
public void onFinishInflate() {
super.onFinishInflate();
this.content = ViewUtil.findById(this, R.id.content);
this.title = ViewUtil.findById(this, R.id.title);
this.subtitle = ViewUtil.findById(this, R.id.subtitle);
this.verified = ViewUtil.findById(this, R.id.verified_indicator);
this.subtitleContainer = ViewUtil.findById(this, R.id.subtitle_container);
this.verifiedSubtitle = ViewUtil.findById(this, R.id.verified_subtitle);
this.avatar = ViewUtil.findById(this, R.id.contact_photo_image);
this.expirationBadgeContainer = ViewUtil.findById(this, R.id.expiration_badge_container);
this.expirationBadgeTime = ViewUtil.findById(this, R.id.expiration_badge);
this.content = findViewById(R.id.content);
this.title = findViewById(R.id.title);
this.subtitle = findViewById(R.id.subtitle);
this.verified = findViewById(R.id.verified_indicator);
this.subtitleContainer = findViewById(R.id.subtitle_container);
this.verifiedSubtitle = findViewById(R.id.verified_subtitle);
this.avatar = findViewById(R.id.contact_photo_image);
this.expirationBadgeContainer = findViewById(R.id.expiration_badge_container);
this.expirationBadgeTime = findViewById(R.id.expiration_badge);
ViewUtil.setTextViewGravityStart(this.title, getContext());
ViewUtil.setTextViewGravityStart(this.subtitle, getContext());
@@ -85,14 +85,22 @@ public class ConversationTitleView extends RelativeLayout {
if (recipient == null) setComposeTitle();
else setRecipientTitle(recipient);
int startDrawable = 0;
int endDrawable = 0;
if (recipient != null && recipient.isBlocked()) {
title.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_block_white_18dp, 0, 0, 0);
startDrawable = R.drawable.ic_block_white_18dp;
} else if (recipient != null && recipient.isMuted()) {
title.setCompoundDrawablesWithIntrinsicBounds(R.drawable.ic_volume_off_white_18dp, 0, 0, 0);
} else {
title.setCompoundDrawablesWithIntrinsicBounds(0, 0, 0, 0);
startDrawable = R.drawable.ic_volume_off_white_18dp;
}
if (recipient != null && recipient.isSystemContact() && !recipient.isLocalNumber()) {
endDrawable = R.drawable.ic_profile_circle_outline_16;
}
title.setCompoundDrawablesRelativeWithIntrinsicBounds(startDrawable, 0, endDrawable, 0);
if (recipient != null) {
this.avatar.setAvatar(glideRequests, recipient, false);
}