aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorChristian Schneppe <christian.schneppe@pix-art.de>2019-09-23 20:21:08 +0200
committerChristian Schneppe <christian.schneppe@pix-art.de>2019-09-23 20:21:08 +0200
commit8b8d17900e22d6e3bc0f759bb61ec9464006dc18 (patch)
tree08dee5bd2b1ddfddc2da2a99c9fea6ff5475e6c6 /src
parent9fd788bf7ef1d4772441715682261424e61e54f8 (diff)
Google Play version use downloadable Emojis instead of bundled
Diffstat (limited to 'src')
-rw-r--r--src/main/java/de/pixart/messenger/services/AbstractEmojiService.java31
-rw-r--r--src/main/java/de/pixart/messenger/services/EmojiService.java21
-rw-r--r--src/standardPush/java/de/pixart/messenger/services/EmojiService.java32
3 files changed, 47 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
diff --git a/src/standardPush/java/de/pixart/messenger/services/EmojiService.java b/src/standardPush/java/de/pixart/messenger/services/EmojiService.java
new file mode 100644
index 000000000..5f79eed43
--- /dev/null
+++ b/src/standardPush/java/de/pixart/messenger/services/EmojiService.java
@@ -0,0 +1,32 @@
+package de.pixart.messenger.services;
+
+import android.content.Context;
+import android.os.Build;
+
+import androidx.emoji.text.EmojiCompat;
+
+public class EmojiService {
+
+ private final Context context;
+
+ public EmojiService(Context context) {
+ this.context = context;
+ }
+
+ public void init(boolean useBundledEmoji) {
+ final FontRequest fontRequest = new FontRequest(
+ "com.google.android.gms.fonts",
+ "com.google.android.gms",
+ "Noto Color Emoji Compat",
+ R.array.font_certs);
+ FontRequestEmojiCompatConfig fontRequestEmojiCompatConfig = new FontRequestEmojiCompatConfig(context, fontRequest);
+ fontRequestEmojiCompatConfig.registerInitCallback(initCallback);
+ //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)
+ // c) can trigger a hardware rendering bug https://issuetracker.google.com/issues/67102093
+ fontRequest.setReplaceAll(useBundledEmoji && Build.VERSION.SDK_INT < Build.VERSION_CODES.O);
+ EmojiCompat.init(config);
+ }
+} \ No newline at end of file