aboutsummaryrefslogtreecommitdiffstats
path: root/src/standard/java/de/pixart/messenger
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-09-23 20:50:35 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-09-23 20:50:35 +0200
commit443925d2e22fc4ca8b74167e01be3dbd2a84cc75 (patch)
treec19a2ece3cfbc996be3e8cb11b45cc8837f53275 /src/standard/java/de/pixart/messenger
parent104c02dc33de44791e4c6f3c869273685e400a4b (diff)
correct file locations for EmojiService
Diffstat (limited to 'src/standard/java/de/pixart/messenger')
-rw-r--r--src/standard/java/de/pixart/messenger/services/EmojiService.java26
1 files changed, 26 insertions, 0 deletions
diff --git a/src/standard/java/de/pixart/messenger/services/EmojiService.java b/src/standard/java/de/pixart/messenger/services/EmojiService.java
new file mode 100644
index 000000000..f76cf5a4b
--- /dev/null
+++ b/src/standard/java/de/pixart/messenger/services/EmojiService.java
@@ -0,0 +1,26 @@
+package de.pixart.messenger.services;
+
+import android.content.Context;
+import android.os.Build;
+
+import androidx.emoji.bundled.BundledEmojiCompatConfig;
+import androidx.emoji.text.EmojiCompat;
+
+public class EmojiService {
+
+ private final Context context;
+
+ public EmojiService(Context context) {
+ this.context = 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