From ad493938a03cadb4747613040bad9c28cf244789 Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 23 Feb 2022 10:37:03 +0100 Subject: [PATCH] bump appcompat, migrate to emoji2 and get rid of emoji flavor --- build.gradle | 80 +++++-------------- .../ui/widget/EmojiWrapperEditText.java | 18 ----- .../conversations/utils/EmojiWrapper.java | 47 ----------- .../services/EmojiInitializationService.java | 14 ++++ .../ui/service/EmojiService.java | 27 ------- .../ui/ConferenceDetailsActivity.java | 7 +- .../ui/ConversationsActivity.java | 3 +- .../siacs/conversations/ui/XmppActivity.java | 4 +- .../ui/adapter/ConversationAdapter.java | 7 +- .../ui/adapter/ListItemAdapter.java | 3 +- .../ui/adapter/MessageAdapter.java | 5 +- .../conversations/ui/widget/EditMessage.java | 3 +- src/main/res/layout/activity_muc_details.xml | 4 +- .../res/layout/create_conference_dialog.xml | 2 +- .../layout/create_public_channel_dialog.xml | 2 +- src/main/res/layout/dialog_quickedit.xml | 4 +- .../services/EmojiInitializationService.java | 10 +++ .../ui/service/EmojiService.java | 55 ------------- src/playstoreCompat/res/values/font_certs.xml | 6 -- .../ui/service/EmojiService.java | 14 ---- .../ui/widget/EmojiWrapperEditText.java | 16 ---- .../conversations/utils/EmojiWrapper.java | 47 ----------- 22 files changed, 63 insertions(+), 315 deletions(-) delete mode 100644 src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java delete mode 100644 src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java create mode 100644 src/free/java/eu/siacs/conversations/services/EmojiInitializationService.java delete mode 100644 src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java create mode 100644 src/playstore/java/eu/siacs/conversations/services/EmojiInitializationService.java delete mode 100644 src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java delete mode 100644 src/playstoreCompat/res/values/font_certs.xml delete mode 100644 src/system/java/eu/siacs/conversations/ui/service/EmojiService.java delete mode 100644 src/system/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java delete mode 100644 src/system/java/eu/siacs/conversations/utils/EmojiWrapper.java diff --git a/build.gradle b/build.gradle index 6f26dc4fc..210fd1f61 100644 --- a/build.gradle +++ b/build.gradle @@ -20,13 +20,13 @@ repositories { configurations { playstoreImplementation - compatImplementation - conversationsFreeCompatImplementation - conversationsPlaystoreCompatImplementation - conversationsPlaystoreSystemImplementation - quicksyPlaystoreCompatImplementation - quicksyPlaystoreSystemImplementation - quicksyFreeCompatImplementation + freeImplementation + conversationsFreeImplementation + conversationsPlaystorImplementation + conversationsPlaystoreImplementation + quicksyPlaystoreImplementation + quicksyPlaystoreImplementation + quicksyFreeImplementation quicksyImplementation } @@ -38,21 +38,19 @@ dependencies { exclude group: 'com.google.firebase', module: 'firebase-analytics' exclude group: 'com.google.firebase', module: 'firebase-measurement-connector' } - conversationsPlaystoreCompatImplementation("com.android.installreferrer:installreferrer:2.2") - conversationsPlaystoreSystemImplementation("com.android.installreferrer:installreferrer:2.2") - quicksyPlaystoreCompatImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1' - quicksyPlaystoreSystemImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1' + conversationsPlaystoreImplementation("com.android.installreferrer:installreferrer:2.2") + quicksyPlaystoreImplementation 'com.google.android.gms:play-services-auth-api-phone:18.0.1' implementation 'org.sufficientlysecure:openpgp-api:10.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' - implementation 'androidx.appcompat:appcompat:1.3.1' + implementation 'androidx.appcompat:appcompat:1.4.1' implementation 'androidx.exifinterface:exifinterface:1.3.3' implementation 'androidx.cardview:cardview:1.0.0' implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.1.0' - implementation 'androidx.emoji:emoji:1.1.0' implementation 'com.google.android.material:material:1.4.0' - compatImplementation 'androidx.emoji:emoji-appcompat:1.1.0' - conversationsFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0' - quicksyFreeCompatImplementation 'androidx.emoji:emoji-bundled:1.1.0' + + implementation "androidx.emoji2:emoji2:1.1.0-rc01" + freeImplementation "androidx.emoji2:emoji2-bundled:1.1.0-rc01" + implementation 'org.bouncycastle:bcmail-jdk15on:1.64' //zxing stopped supporting Java 7 so we have to stick with 3.3.3 //https://github.com/zxing/zxing/issues/1170 @@ -122,7 +120,7 @@ android { targetCompatibility JavaVersion.VERSION_1_8 } - flavorDimensions("mode", "distribution", "emoji") + flavorDimensions("mode", "distribution") productFlavors { @@ -148,39 +146,15 @@ android { dimension "distribution" versionNameSuffix "+f" } - system { - dimension "emoji" - versionNameSuffix "s" - } - compat { - dimension "emoji" - versionNameSuffix "c" - } } sourceSets { - quicksyFreeSystem { + quicksyFree { java { srcDir 'src/quicksyFree/java' } } - quicksyFreeCompat { - java { - srcDir 'src/freeCompat/java' - srcDir 'src/quicksyFree/java' - } - } - quicksyPlaystoreCompat { - java { - srcDir 'src/playstoreCompat/java' - srcDir 'src/quicksyPlaystore/java' - } - res { - srcDir 'src/playstoreCompat/res' - srcDir 'src/quicksyPlaystore/res' - } - } - quicksyPlaystoreSystem { + quicksyPlaystore { java { srcDir 'src/quicksyPlaystore/java' } @@ -188,28 +162,12 @@ android { srcDir 'src/quicksyPlaystore/res' } } - conversationsFreeCompat { - java { - srcDir 'src/freeCompat/java' - srcDir 'src/conversationsFree/java' - } - } - conversationsFreeSystem { + conversationsFree { java { srcDir 'src/conversationsFree/java' } } - conversationsPlaystoreCompat { - java { - srcDir 'src/playstoreCompat/java' - srcDir 'src/conversationsPlaystore/java' - } - res { - srcDir 'src/playstoreCompat/res' - srcDir 'src/conversationsPlaystore/res' - } - } - conversationsPlaystoreSystem { + conversationsPlaystore { java { srcDir 'src/conversationsPlaystore/java' } diff --git a/src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java b/src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java deleted file mode 100644 index 01905e376..000000000 --- a/src/compat/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java +++ /dev/null @@ -1,18 +0,0 @@ -package eu.siacs.conversations.ui.widget; - -import android.content.Context; -import android.util.AttributeSet; - -import androidx.emoji.widget.EmojiAppCompatEditText; - -public class EmojiWrapperEditText extends EmojiAppCompatEditText { - - public EmojiWrapperEditText(Context context) { - super(context); - } - - public EmojiWrapperEditText(Context context, AttributeSet attrs) { - super(context, attrs); - } - -} \ No newline at end of file diff --git a/src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java b/src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java deleted file mode 100644 index 3b6cf71e1..000000000 --- a/src/compat/java/eu/siacs/conversations/utils/EmojiWrapper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017, Daniel Gultsch All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package eu.siacs.conversations.utils; - -import androidx.emoji.text.EmojiCompat; - -public class EmojiWrapper { - - public static CharSequence transform(CharSequence input) { - try { - if (EmojiCompat.get().getLoadState() == EmojiCompat.LOAD_STATE_SUCCEEDED) { - return EmojiCompat.get().process(input); - } else { - return input; - } - } catch (IllegalStateException e) { - return input; - } - } -} diff --git a/src/free/java/eu/siacs/conversations/services/EmojiInitializationService.java b/src/free/java/eu/siacs/conversations/services/EmojiInitializationService.java new file mode 100644 index 000000000..2618d3809 --- /dev/null +++ b/src/free/java/eu/siacs/conversations/services/EmojiInitializationService.java @@ -0,0 +1,14 @@ +package eu.siacs.conversations.services; + +import android.content.Context; + +import androidx.emoji2.bundled.BundledEmojiCompatConfig; +import androidx.emoji2.text.EmojiCompat; + +public class EmojiInitializationService { + + public static void execute(final Context context) { + EmojiCompat.init(new BundledEmojiCompatConfig(context).setReplaceAll(true)); + } + +} diff --git a/src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java b/src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java deleted file mode 100644 index 1f60368bb..000000000 --- a/src/freeCompat/java/eu/siacs/conversations/ui/service/EmojiService.java +++ /dev/null @@ -1,27 +0,0 @@ -package eu.siacs.conversations.ui.service; - -import android.content.Context; -import android.os.Build; -import androidx.emoji.text.EmojiCompat; -import androidx.emoji.text.FontRequestEmojiCompatConfig; -import androidx.emoji.bundled.BundledEmojiCompatConfig; - -public class EmojiService { - - private final Context context; - - public EmojiService(Context context) { - this.context = context; - } - - public void init() { - 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(Build.VERSION.SDK_INT < Build.VERSION_CODES.O); - EmojiCompat.init(config); - } - -} \ No newline at end of file diff --git a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java index d35d4808c..fb716044c 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConferenceDetailsActivity.java @@ -46,7 +46,6 @@ import eu.siacs.conversations.ui.util.MyLinkify; import eu.siacs.conversations.ui.util.SoftKeyboardUtils; import eu.siacs.conversations.utils.AccountUtils; import eu.siacs.conversations.utils.Compatibility; -import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.StringUtils; import eu.siacs.conversations.utils.StylingHelper; import eu.siacs.conversations.utils.XmppUri; @@ -471,11 +470,11 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers String subject = mucOptions.getSubject(); final boolean hasTitle; if (printableValue(roomName)) { - this.binding.mucTitle.setText(EmojiWrapper.transform(roomName)); + this.binding.mucTitle.setText(roomName); this.binding.mucTitle.setVisibility(View.VISIBLE); hasTitle = true; } else if (!printableValue(subject)) { - this.binding.mucTitle.setText(EmojiWrapper.transform(mConversation.getName())); + this.binding.mucTitle.setText(mConversation.getName()); hasTitle = true; this.binding.mucTitle.setVisibility(View.VISIBLE); } else { @@ -486,7 +485,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers SpannableStringBuilder spannable = new SpannableStringBuilder(subject); StylingHelper.format(spannable, this.binding.mucSubject.getCurrentTextColor()); MyLinkify.addLinks(spannable, false); - this.binding.mucSubject.setText(EmojiWrapper.transform(spannable)); + this.binding.mucSubject.setText(spannable); this.binding.mucSubject.setTextAppearance(this, subject.length() > (hasTitle ? 128 : 196) ? R.style.TextAppearance_Conversations_Body1_Linkified : R.style.TextAppearance_Conversations_Subhead); this.binding.mucSubject.setAutoLinkMask(0); this.binding.mucSubject.setVisibility(View.VISIBLE); diff --git a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java index cc46ed33f..308e139fc 100644 --- a/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/ConversationsActivity.java @@ -81,7 +81,6 @@ import eu.siacs.conversations.ui.util.ActivityResult; import eu.siacs.conversations.ui.util.ConversationMenuConfigurator; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.PendingItem; -import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.ExceptionHelper; import eu.siacs.conversations.utils.SignupUtils; import eu.siacs.conversations.utils.XmppUri; @@ -625,7 +624,7 @@ public class ConversationsActivity extends XmppActivity implements OnConversatio if (mainFragment instanceof ConversationFragment) { final Conversation conversation = ((ConversationFragment) mainFragment).getConversation(); if (conversation != null) { - actionBar.setTitle(EmojiWrapper.transform(conversation.getName())); + actionBar.setTitle(conversation.getName()); actionBar.setDisplayHomeAsUpEnabled(true); ActionBarUtil.setActionBarOnClickListener( binding.toolbar, diff --git a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java index 4b5382b44..4ca49fa50 100644 --- a/src/main/java/eu/siacs/conversations/ui/XmppActivity.java +++ b/src/main/java/eu/siacs/conversations/ui/XmppActivity.java @@ -71,10 +71,10 @@ import eu.siacs.conversations.entities.Message; import eu.siacs.conversations.entities.Presences; import eu.siacs.conversations.services.AvatarService; import eu.siacs.conversations.services.BarcodeProvider; +import eu.siacs.conversations.services.EmojiInitializationService; import eu.siacs.conversations.services.QuickConversationsService; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.services.XmppConnectionService.XmppConnectionBinder; -import eu.siacs.conversations.ui.service.EmojiService; import eu.siacs.conversations.ui.util.MenuDoubleTabUtil; import eu.siacs.conversations.ui.util.PresenceSelector; import eu.siacs.conversations.ui.util.SoftKeyboardUtils; @@ -408,7 +408,7 @@ public abstract class XmppActivity extends ActionBarActivity { super.onCreate(savedInstanceState); metrics = getResources().getDisplayMetrics(); ExceptionHelper.init(getApplicationContext()); - new EmojiService(this).init(); + EmojiInitializationService.execute(this); this.isCameraFeatureAvailable = getPackageManager().hasSystemFeature(PackageManager.FEATURE_CAMERA_ANY); this.mTheme = findTheme(); setTheme(this.mTheme); diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index 049703597..662120d84 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -23,7 +23,6 @@ import eu.siacs.conversations.ui.ConversationFragment; import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.StyledAttributes; -import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.utils.UIHelper; import eu.siacs.conversations.xmpp.Jid; @@ -57,7 +56,7 @@ public class ConversationAdapter extends RecyclerView.Adapter preview = UIHelper.getMessagePreview(activity, message, viewHolder.binding.conversationLastmsg.getCurrentTextColor()); if (showPreviewText) { - viewHolder.binding.conversationLastmsg.setText(EmojiWrapper.transform(UIHelper.shorten(preview.first))); + viewHolder.binding.conversationLastmsg.setText(UIHelper.shorten(preview.first)); } else { viewHolder.binding.conversationLastmsgImg.setContentDescription(preview.first); } diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java index 4e7213380..5d6d72684 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/ListItemAdapter.java @@ -22,7 +22,6 @@ import eu.siacs.conversations.ui.SettingsActivity; import eu.siacs.conversations.ui.XmppActivity; import eu.siacs.conversations.ui.util.AvatarWorkerTask; import eu.siacs.conversations.ui.util.StyledAttributes; -import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.IrregularUnicodeDetector; import eu.siacs.conversations.xmpp.Jid; @@ -85,7 +84,7 @@ public class ListItemAdapter extends ArrayAdapter { } else { viewHolder.jid.setVisibility(View.GONE); } - viewHolder.name.setText(EmojiWrapper.transform(item.getDisplayName())); + viewHolder.name.setText(item.getDisplayName()); AvatarWorkerTask.loadAvatar(item, viewHolder.avatar, R.dimen.avatar); return view; } diff --git a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java index ccb40418a..a5ba05819 100644 --- a/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -63,7 +63,6 @@ import eu.siacs.conversations.ui.util.QuoteHelper; import eu.siacs.conversations.ui.util.ViewUtil; import eu.siacs.conversations.ui.widget.ClickableMovementMethod; import eu.siacs.conversations.utils.CryptoHelper; -import eu.siacs.conversations.utils.EmojiWrapper; import eu.siacs.conversations.utils.Emoticons; import eu.siacs.conversations.utils.GeoHelper; import eu.siacs.conversations.utils.MessageUtils; @@ -335,7 +334,7 @@ public class MessageAdapter extends ArrayAdapter { Spannable span = new SpannableString(body); float size = Emoticons.isEmoji(body) ? 3.0f : 2.0f; span.setSpan(new RelativeSizeSpan(size), 0, body.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); - viewHolder.messageBody.setText(EmojiWrapper.transform(span)); + viewHolder.messageBody.setText(span); } private void applyQuoteSpan(SpannableStringBuilder body, int start, int end, boolean darkBackground) { @@ -494,7 +493,7 @@ public class MessageAdapter extends ArrayAdapter { } MyLinkify.addLinks(body, true); viewHolder.messageBody.setAutoLinkMask(0); - viewHolder.messageBody.setText(EmojiWrapper.transform(body)); + viewHolder.messageBody.setText(body); viewHolder.messageBody.setMovementMethod(ClickableMovementMethod.getInstance()); } else { viewHolder.messageBody.setText(""); diff --git a/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java b/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java index eba833c9b..e890e5984 100644 --- a/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java +++ b/src/main/java/eu/siacs/conversations/ui/widget/EditMessage.java @@ -15,6 +15,7 @@ import android.view.KeyEvent; import android.view.inputmethod.EditorInfo; import android.view.inputmethod.InputConnection; +import androidx.appcompat.widget.AppCompatEditText; import androidx.core.view.inputmethod.EditorInfoCompat; import androidx.core.view.inputmethod.InputConnectionCompat; import androidx.core.view.inputmethod.InputContentInfoCompat; @@ -26,7 +27,7 @@ import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.ui.util.QuoteHelper; -public class EditMessage extends EmojiWrapperEditText { +public class EditMessage extends AppCompatEditText { private static final InputFilter SPAN_FILTER = (source, start, end, dest, dstart, dend) -> source instanceof Spanned ? source.toString() : source; private final ExecutorService executor = Executors.newSingleThreadExecutor(); diff --git a/src/main/res/layout/activity_muc_details.xml b/src/main/res/layout/activity_muc_details.xml index d19bf93e9..f2b4b00d7 100644 --- a/src/main/res/layout/activity_muc_details.xml +++ b/src/main/res/layout/activity_muc_details.xml @@ -106,7 +106,7 @@ app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error" app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint"> - - - - - - + diff --git a/src/playstore/java/eu/siacs/conversations/services/EmojiInitializationService.java b/src/playstore/java/eu/siacs/conversations/services/EmojiInitializationService.java new file mode 100644 index 000000000..b5a57d374 --- /dev/null +++ b/src/playstore/java/eu/siacs/conversations/services/EmojiInitializationService.java @@ -0,0 +1,10 @@ +package eu.siacs.conversations.services; + +import android.content.Context; + +public class EmojiInitializationService { + + public static void execute(final Context context) { + + } +} diff --git a/src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java b/src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java deleted file mode 100644 index 5ed8c100a..000000000 --- a/src/playstoreCompat/java/eu/siacs/conversations/ui/service/EmojiService.java +++ /dev/null @@ -1,55 +0,0 @@ -package eu.siacs.conversations.ui.service; - -import android.content.Context; -import android.os.Build; -import android.util.Log; - -import androidx.core.provider.FontRequest; -import androidx.emoji.text.EmojiCompat; -import androidx.emoji.text.FontRequestEmojiCompatConfig; - -import eu.siacs.conversations.Config; -import eu.siacs.conversations.R; - -public class EmojiService { - - - private final EmojiCompat.InitCallback initCallback = new EmojiCompat.InitCallback() { - @Override - public void onInitialized() { - super.onInitialized(); - Log.d(Config.LOGTAG, "EmojiService succeeded in loading fonts"); - - } - - @Override - public void onFailed(Throwable throwable) { - super.onFailed(throwable); - Log.d(Config.LOGTAG, "EmojiService failed to load fonts", throwable); - } - }; - - private final Context context; - - public EmojiService(Context context) { - this.context = context; - } - - public void init() { - 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 - fontRequestEmojiCompatConfig.setReplaceAll(Build.VERSION.SDK_INT < Build.VERSION_CODES.O); - EmojiCompat.init(fontRequestEmojiCompatConfig); - } - -} \ No newline at end of file diff --git a/src/playstoreCompat/res/values/font_certs.xml b/src/playstoreCompat/res/values/font_certs.xml deleted file mode 100644 index cc0ad3b3c..000000000 --- a/src/playstoreCompat/res/values/font_certs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK - - \ No newline at end of file diff --git a/src/system/java/eu/siacs/conversations/ui/service/EmojiService.java b/src/system/java/eu/siacs/conversations/ui/service/EmojiService.java deleted file mode 100644 index 6ca66fd62..000000000 --- a/src/system/java/eu/siacs/conversations/ui/service/EmojiService.java +++ /dev/null @@ -1,14 +0,0 @@ -package eu.siacs.conversations.ui.service; - -import android.content.Context; - -public class EmojiService { - - public EmojiService(Context context) { - //nop - } - - public void init() { - //nop - } -} \ No newline at end of file diff --git a/src/system/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java b/src/system/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java deleted file mode 100644 index 58e1ab318..000000000 --- a/src/system/java/eu/siacs/conversations/ui/widget/EmojiWrapperEditText.java +++ /dev/null @@ -1,16 +0,0 @@ -package eu.siacs.conversations.ui.widget; - -import android.content.Context; -import androidx.appcompat.widget.AppCompatEditText; -import android.util.AttributeSet; - -public class EmojiWrapperEditText extends AppCompatEditText { - - public EmojiWrapperEditText(Context context) { - super(context); - } - - public EmojiWrapperEditText(Context context, AttributeSet attrs) { - super(context, attrs); - } -} \ No newline at end of file diff --git a/src/system/java/eu/siacs/conversations/utils/EmojiWrapper.java b/src/system/java/eu/siacs/conversations/utils/EmojiWrapper.java deleted file mode 100644 index 3b6cf71e1..000000000 --- a/src/system/java/eu/siacs/conversations/utils/EmojiWrapper.java +++ /dev/null @@ -1,47 +0,0 @@ -/* - * Copyright (c) 2017, Daniel Gultsch All rights reserved. - * - * Redistribution and use in source and binary forms, with or without modification, - * are permitted provided that the following conditions are met: - * - * 1. Redistributions of source code must retain the above copyright notice, this - * list of conditions and the following disclaimer. - * - * 2. Redistributions in binary form must reproduce the above copyright notice, - * this list of conditions and the following disclaimer in the documentation and/or - * other materials provided with the distribution. - * - * 3. Neither the name of the copyright holder nor the names of its contributors - * may be used to endorse or promote products derived from this software without - * specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED - * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE - * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR - * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES - * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; - * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON - * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS - * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - */ - -package eu.siacs.conversations.utils; - -import androidx.emoji.text.EmojiCompat; - -public class EmojiWrapper { - - public static CharSequence transform(CharSequence input) { - try { - if (EmojiCompat.get().getLoadState() == EmojiCompat.LOAD_STATE_SUCCEEDED) { - return EmojiCompat.get().process(input); - } else { - return input; - } - } catch (IllegalStateException e) { - return input; - } - } -}