Skip to content

Commit

Permalink
Force custom emoji for reactions.
Browse files Browse the repository at this point in the history
  • Loading branch information
greyson-signal committed Feb 4, 2020
1 parent 1ff5b2a commit a5d7bc4
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@
public class EmojiTextView extends AppCompatTextView {

private final boolean scaleEmojis;
private final boolean forceCustom;

private static final char ELLIPSIS = '…';

Expand All @@ -49,6 +50,7 @@ public EmojiTextView(Context context, AttributeSet attrs, int defStyleAttr) {
TypedArray a = context.getTheme().obtainStyledAttributes(attrs, R.styleable.EmojiTextView, 0, 0);
scaleEmojis = a.getBoolean(R.styleable.EmojiTextView_scaleEmojis, false);
maxLength = a.getInteger(R.styleable.EmojiTextView_emoji_maxLength, -1);
forceCustom = a.getBoolean(R.styleable.EmojiTextView_emoji_forceCustom, false);
a.recycle();

a = context.obtainStyledAttributes(attrs, new int[]{android.R.attr.textSize});
Expand Down Expand Up @@ -166,7 +168,7 @@ private boolean unchanged(CharSequence text, CharSequence overflowText, BufferTy
}

private boolean useSystemEmoji() {
return TextSecurePreferences.isSystemEmojiPreferred(getContext());
return !forceCustom && TextSecurePreferences.isSystemEmojiPreferred(getContext());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="62dp"
android:layout_height="36dp"
android:layout_marginStart="6dp"
Expand All @@ -19,6 +20,7 @@
android:includeFontPadding="false"
android:textSize="22dp"
android:textStyle="bold"
app:emoji_forceCustom="true"
tools:ignore="SpUsage"
tools:text=":-)" />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
android:layout_marginStart="16dp"
android:gravity="center"
android:textSize="22dp"
app:emoji_forceCustom="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/layout/reactions_pill.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
Expand All @@ -16,6 +17,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="16dp"
app:emoji_forceCustom="true"
tools:ignore="SpUsage" />

<Space
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/attrs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -336,6 +336,7 @@
<declare-styleable name="EmojiTextView">
<attr name="scaleEmojis" format="boolean" />
<attr name="emoji_maxLength" format="integer" />
<attr name="emoji_forceCustom" format="boolean" />
</declare-styleable>

<declare-styleable name="RingtonePreference">
Expand Down

1 comment on commit a5d7bc4

@Meteor0id
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

But why? Why not let users view emojis as the system emojis they are used to?

Please sign in to comment.