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 --- .../de/pixart/messenger/services/EmojiService.java | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) (limited to 'src/main/java/de/pixart/messenger/services/EmojiService.java') 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