From c6d3bed8daca856ad1098731ec28d93a8d9d4f83 Mon Sep 17 00:00:00 2001 From: Greyson Parrelli Date: Fri, 1 Feb 2019 09:17:07 -0800 Subject: [PATCH] Hide emoji button in media flows when system emoji are enabled. Fixes #8581 --- .../securesms/mediasend/MediaSendFragment.java | 9 +++++++-- .../thoughtcrime/securesms/scribbles/ScribbleHud.java | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java b/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java index cb22f01359..097b32fa82 100644 --- a/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java +++ b/src/org/thoughtcrime/securesms/mediasend/MediaSendFragment.java @@ -180,8 +180,6 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl captionText.clearFocus(); composeText.requestFocus(); - emojiToggle.setOnClickListener(this::onEmojiToggleClicked); - fragmentPagerAdapter = new MediaSendFragmentPagerAdapter(requireActivity().getSupportFragmentManager(), locale); fragmentPager.setAdapter(fragmentPagerAdapter); @@ -210,6 +208,13 @@ public class MediaSendFragment extends Fragment implements ViewTreeObserver.OnGl sendButton.disableTransport(transportOption.getType() == TransportOption.Type.SMS ? TransportOption.Type.TEXTSECURE : TransportOption.Type.SMS); composeText.append(getArguments().getString(KEY_BODY)); + + + if (TextSecurePreferences.isSystemEmojiPreferred(getContext())) { + emojiToggle.setVisibility(View.GONE); + } else { + emojiToggle.setOnClickListener(this::onEmojiToggleClicked); + } } @Override diff --git a/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java b/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java index 28cef2afe1..03955fc746 100644 --- a/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java +++ b/src/org/thoughtcrime/securesms/scribbles/ScribbleHud.java @@ -177,13 +177,17 @@ public class ScribbleHud extends InputAwareLayout implements ViewTreeObserver.On composeText.setOnClickListener(composeKeyPressedListener); composeText.setOnFocusChangeListener(composeKeyPressedListener); - emojiToggle.setOnClickListener(this::onEmojiToggleClicked); - colorPaletteAdapter = new ColorPaletteAdapter(); colorPaletteAdapter.setEventListener(colorPicker::setActiveColor); colorPalette.setLayoutManager(new LinearLayoutManager(getContext())); colorPalette.setAdapter(colorPaletteAdapter); + + if (TextSecurePreferences.isSystemEmojiPreferred(getContext())) { + emojiToggle.setVisibility(GONE); + } else { + emojiToggle.setOnClickListener(this::onEmojiToggleClicked); + } } public void setLocale(@NonNull Locale locale) {