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 | |
parent | 9fd788bf7ef1d4772441715682261424e61e54f8 (diff) |
Google Play version use downloadable Emojis instead of bundled
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/services/AbstractEmojiService.java | 31 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/services/EmojiService.java | 21 |
2 files changed, 15 insertions, 37 deletions
diff --git a/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java b/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java deleted file mode 100644 index 377e21f4c..000000000 --- a/src/main/java/de/pixart/messenger/services/AbstractEmojiService.java +++ /dev/null @@ -1,31 +0,0 @@ -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); - } -}
\ No newline at end of file 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 |