blob: 377e21f4ce50eb3bce46b1ce56913e864a00ab16 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
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);
}
}
|