From 8b8d17900e22d6e3bc0f759bb61ec9464006dc18 Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 23 Sep 2019 20:21:08 +0200 Subject: Google Play version use downloadable Emojis instead of bundled --- .../messenger/services/AbstractEmojiService.java | 31 ---------------------- .../de/pixart/messenger/services/EmojiService.java | 21 ++++++++++----- 2 files changed, 15 insertions(+), 37 deletions(-) delete mode 100644 src/main/java/de/pixart/messenger/services/AbstractEmojiService.java (limited to 'src/main') diff --git a/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java b/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java deleted file mode 100644 index 377e21f4c..000000000 --- a/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java +++ /dev/null @@ -1,31 +0,0 @@ -package de.pixart.messenger.services; - -import android.content.Context; -import android.os.Build; -import androidx.emoji.text.EmojiCompat; -import android.util.Log; - -import de.pixart.messenger.Config; - -public abstract class AbstractEmojiService { - - protected final Context context; - - public AbstractEmojiService(Context context) { - this.context = context; - } - - protected abstract EmojiCompat.Config buildConfig(); - - public void init(boolean useBundledEmoji) { - Log.d(Config.LOGTAG, "Emojis: use integrated lib " + useBundledEmoji); - 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/services/EmojiService.java b/src/main/java/de/pixart/messenger/services/EmojiService.java index 26be25202..f76cf5a4b 100644 --- a/src/main/java/de/pixart/messenger/services/EmojiService.java +++ b/src/main/java/de/pixart/messenger/services/EmojiService.java @@ -1,17 +1,26 @@ package de.pixart.messenger.services; import android.content.Context; -import androidx.emoji.text.EmojiCompat; +import android.os.Build; + import androidx.emoji.bundled.BundledEmojiCompatConfig; +import androidx.emoji.text.EmojiCompat; + +public class EmojiService { -public class EmojiService extends AbstractEmojiService { + private final Context context; public EmojiService(Context context) { - super(context); + this.context = context; } - @Override - protected EmojiCompat.Config buildConfig() { - return new BundledEmojiCompatConfig(context); + public void init(boolean useBundledEmoji) { + BundledEmojiCompatConfig config = new BundledEmojiCompatConfig(context); + //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) the text preview has annoying glitches when the cut of text contains emojis (the emoji will be half visible) + // b) can trigger a hardware rendering bug https://issuetracker.google.com/issues/67102093 + config.setReplaceAll(useBundledEmoji && Build.VERSION.SDK_INT < Build.VERSION_CODES.O); + EmojiCompat.init(config); } } \ No newline at end of file -- cgit v1.2.3