cheogram/src/main/java/eu/siacs/conversations/ui/service/AbstractEmojiService.java
2018-03-17 21:43:18 +01:00

27 lines
898 B
Java
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package eu.siacs.conversations.ui.service;
import android.content.Context;
import android.os.Build;
import android.support.text.emoji.EmojiCompat;
public abstract class AbstractEmojiService {
protected final Context context;
public AbstractEmojiService(Context context) {
this.context = context;
}
protected abstract EmojiCompat.Config buildConfig();
public void init() {
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 dont work
// b) the text preview has annoying glitches when the cut of text contains emojis (the emoji will be half visible)
config.setReplaceAll(Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
EmojiCompat.init(config);
}
}