mirror of
https://github.com/oxen-io/session-android.git
synced 2025-02-19 21:18:27 +00:00
parent
9ea53d7b1e
commit
b55df9e186
@ -17,7 +17,6 @@ import org.thoughtcrime.securesms.util.ViewUtil;
|
||||
public class EmojiTextView extends AppCompatTextView {
|
||||
private CharSequence source;
|
||||
private boolean needsEllipsizing;
|
||||
private boolean useSystemEmoji;
|
||||
|
||||
public EmojiTextView(Context context) {
|
||||
this(context, null);
|
||||
@ -29,11 +28,10 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
|
||||
public EmojiTextView(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.useSystemEmoji = TextSecurePreferences.isSystemEmojiPreferred(getContext());
|
||||
}
|
||||
|
||||
@Override public void setText(@Nullable CharSequence text, BufferType type) {
|
||||
if (useSystemEmoji) {
|
||||
if (useSystemEmoji()) {
|
||||
super.setText(text, type);
|
||||
return;
|
||||
}
|
||||
@ -42,6 +40,10 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
setTextEllipsized(source);
|
||||
}
|
||||
|
||||
private boolean useSystemEmoji() {
|
||||
return TextSecurePreferences.isSystemEmojiPreferred(getContext());
|
||||
}
|
||||
|
||||
private void setTextEllipsized(final @Nullable CharSequence source) {
|
||||
super.setText(needsEllipsizing ? ViewUtil.ellipsize(source, this) : source, BufferType.SPANNABLE);
|
||||
}
|
||||
@ -54,7 +56,7 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
|
||||
final int size = MeasureSpec.getSize(widthMeasureSpec);
|
||||
final int mode = MeasureSpec.getMode(widthMeasureSpec);
|
||||
if (!useSystemEmoji &&
|
||||
if (!useSystemEmoji() &&
|
||||
getEllipsize() == TruncateAt.END &&
|
||||
!TextUtils.isEmpty(source) &&
|
||||
(mode == MeasureSpec.AT_MOST || mode == MeasureSpec.EXACTLY) &&
|
||||
@ -71,7 +73,7 @@ public class EmojiTextView extends AppCompatTextView {
|
||||
}
|
||||
|
||||
@Override protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
||||
if (changed && !useSystemEmoji) setTextEllipsized(source);
|
||||
if (changed && !useSystemEmoji()) setTextEllipsized(source);
|
||||
super.onLayout(changed, left, top, right, bottom);
|
||||
}
|
||||
}
|
||||
|
@ -40,7 +40,6 @@ public class AdvancedPreferenceFragment extends PreferenceFragment {
|
||||
|
||||
private static final String PUSH_MESSAGING_PREF = "pref_toggle_push_messaging";
|
||||
private static final String SUBMIT_DEBUG_LOG_PREF = "pref_submit_debug_logs";
|
||||
private static final String SYSTEM_EMOJI_PREF = TextSecurePreferences.SYSTEM_EMOJI_PREF;
|
||||
|
||||
private static final int PICK_IDENTITY_CONTACT = 1;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user