1package eu.siacs.conversations.ui.service;
2
3import android.content.Context;
4import android.os.Build;
5import androidx.emoji.text.EmojiCompat;
6import androidx.emoji.text.FontRequestEmojiCompatConfig;
7import androidx.emoji.bundled.BundledEmojiCompatConfig;
8
9public class EmojiService {
10
11 private final Context context;
12
13 public EmojiService(Context context) {
14 this.context = context;
15 }
16
17 public void init() {
18 BundledEmojiCompatConfig config = new BundledEmojiCompatConfig(context);
19 //On recent Androids we assume to have the latest emojis
20 //there are some annoying bugs with emoji compat that make it a safer choice not to use it when possible
21 // a) the text preview has annoying glitches when the cut of text contains emojis (the emoji will be half visible)
22 // b) can trigger a hardware rendering bug https://issuetracker.google.com/issues/67102093
23 config.setReplaceAll(Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
24 EmojiCompat.init(config);
25 }
26
27}