Use custom emoji for avatars.

This commit is contained in:
Greyson Parrelli
2021-07-26 08:56:20 -04:00
parent d0827eb48e
commit 7e4396ae3f
5 changed files with 13 additions and 2 deletions

View File

@@ -30,6 +30,7 @@ class TextAvatarDrawable(
textView.text = avatar.text
textView.gravity = Gravity.CENTER
textView.setTextColor(if (inverted) avatar.color.backgroundColor else avatar.color.foregroundColor)
textView.setForceCustomEmoji(true)
layout.addView(textView)

View File

@@ -33,10 +33,10 @@ import java.util.List;
public class EmojiTextView extends AppCompatTextView {
private final boolean scaleEmojis;
private final boolean forceCustom;
private static final char ELLIPSIS = '…';
private boolean forceCustom;
private CharSequence previousText;
private BufferType previousBufferType;
private float originalFontSize;
@@ -144,6 +144,13 @@ public class EmojiTextView extends AppCompatTextView {
setText(previousText, BufferType.SPANNABLE);
}
public void setForceCustomEmoji(boolean forceCustom) {
if (this.forceCustom != forceCustom) {
this.forceCustom = forceCustom;
setText(previousText, BufferType.SPANNABLE);
}
}
private void ellipsizeAnyTextForMaxLength() {
if (maxLength > 0 && getText().length() > maxLength + 1) {
SpannableStringBuilder newContent = new SpannableStringBuilder();