diff options
author | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-09-23 20:21:08 +0200 |
---|---|---|
committer | Christian Schneppe <christian.schneppe@pix-art.de> | 2019-09-23 20:21:08 +0200 |
commit | 8b8d17900e22d6e3bc0f759bb61ec9464006dc18 (patch) | |
tree | 08dee5bd2b1ddfddc2da2a99c9fea6ff5475e6c6 /src/main/java/de/pixart/messenger/services/EmojiService.java | |
parent | 9fd788bf7ef1d4772441715682261424e61e54f8 (diff) |
Google Play version use downloadable Emojis instead of bundled
Diffstat (limited to 'src/main/java/de/pixart/messenger/services/EmojiService.java')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/EmojiService.java | 21 |
1 files changed, 15 insertions, 6 deletions
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 |