mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Use custom emoji for avatars.
This commit is contained in:
@@ -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)
|
||||
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -37,6 +37,7 @@
|
||||
app:layout_constraintEnd_toEndOf="@id/avatar_picker_item_image"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar_picker_item_image"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar_picker_item_image"
|
||||
app:emoji_forceCustom="true"
|
||||
tools:ignore="SpUsage"
|
||||
tools:text="AF" />
|
||||
|
||||
|
||||
@@ -22,7 +22,8 @@
|
||||
android:layout_height="match_parent"
|
||||
android:fontFamily="sans-serif-medium"
|
||||
android:gravity="center"
|
||||
tools:text="AF" />
|
||||
tools:text="AF"
|
||||
app:emoji_forceCustom="true"/>
|
||||
|
||||
<View
|
||||
android:id="@+id/avatar_picker_item_fader"
|
||||
|
||||
@@ -39,6 +39,7 @@
|
||||
app:layout_constraintEnd_toEndOf="@id/avatar_picker_item_image"
|
||||
app:layout_constraintStart_toStartOf="@id/avatar_picker_item_image"
|
||||
app:layout_constraintTop_toTopOf="@id/avatar_picker_item_image"
|
||||
app:emoji_forceCustom="true"
|
||||
tools:ignore="SpUsage"
|
||||
tools:text="AF" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
Reference in New Issue
Block a user