aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/services/AbstractEmojiService.java11
-rw-r--r--src/main/java/de/pixart/messenger/ui/SettingsActivity.java17
2 files changed, 25 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java b/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java
index 58cb5eaa4..5eacdb676 100644
--- a/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java
+++ b/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java
@@ -1,6 +1,7 @@
package de.pixart.messenger.services;
import android.content.Context;
+import android.os.Build;
import android.support.text.emoji.EmojiCompat;
import android.util.Log;
@@ -18,9 +19,13 @@ public abstract class AbstractEmojiService {
public void init(boolean useBundledEmoji) {
Log.d(Config.LOGTAG, "Emojis: use integrated lib " + useBundledEmoji);
- EmojiCompat.Config config = buildConfig();
- config.setReplaceAll(useBundledEmoji);
- EmojiCompat.reset(config);
+ final EmojiCompat.Config config = buildConfig();
+ //On recent Androids we assume to have the latest emojis
+ //there are some annoying bugs with emoji compat that make it a safer choice not to use it when possible
+ // a) when using the ondemand emoji font (play store) flags don’t work
+ // b) the text preview has annoying glitches when the cut of text contains emojis (the emoji will be half visible)
+ config.setReplaceAll(useBundledEmoji && Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
+
EmojiCompat.init(config);
}
} \ No newline at end of file
diff --git a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
index b46cf63b9..eaefb1fa2 100644
--- a/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
+++ b/src/main/java/de/pixart/messenger/ui/SettingsActivity.java
@@ -61,7 +61,10 @@ public class SettingsActivity extends XmppActivity implements
private SettingsFragment mSettingsFragment;
Preference multiAccountPreference;
+ Preference BundledEmojiPreference;
+
boolean isMultiAccountChecked = false;
+ boolean isBundledEmojiChecked;
@Override
protected void onCreate(Bundle savedInstanceState) {
@@ -95,6 +98,11 @@ public class SettingsActivity extends XmppActivity implements
isMultiAccountChecked = ((CheckBoxPreference) multiAccountPreference).isChecked();
}
+ BundledEmojiPreference = mSettingsFragment.findPreference("use_bundled_emoji");
+ if (BundledEmojiPreference != null) {
+ isBundledEmojiChecked = ((CheckBoxPreference) BundledEmojiPreference).isChecked();
+ }
+
if (Config.FORCE_ORBOT) {
PreferenceCategory connectionOptions = (PreferenceCategory) mSettingsFragment.findPreference("connection_options");
PreferenceScreen expert = (PreferenceScreen) mSettingsFragment.findPreference("expert");
@@ -219,6 +227,15 @@ public class SettingsActivity extends XmppActivity implements
deleteOmemoPreference.setOnPreferenceClickListener(preference -> deleteOmemoIdentities());
}
+ final Preference useBundledEmojis = mSettingsFragment.findPreference("use_bundled_emoji");
+ if (useBundledEmojis != null) {
+ Log.d(Config.LOGTAG, "Bundled Emoji checkbox checked: " + isBundledEmojiChecked);
+ if (Build.VERSION.SDK_INT > Build.VERSION_CODES.O && isBundledEmojiChecked) {
+ ((CheckBoxPreference) BundledEmojiPreference).setChecked(false);
+ useBundledEmojis.setEnabled(false);
+ }
+ }
+
final Preference enableMultiAccountsPreference = mSettingsFragment.findPreference("enable_multi_accounts");
if (enableMultiAccountsPreference != null) {
Log.d(Config.LOGTAG, "Multi account checkbox checked: " + isMultiAccountChecked);