bump appcompat, migrate to emoji2 and get rid of emoji flavor
This commit is contained in:
parent
4129ca6af8
commit
ad493938a0
80
build.gradle
80
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'
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -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));
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -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);
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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<ConversationAdapte
|
|||
if (name instanceof Jid) {
|
||||
viewHolder.binding.conversationName.setText(IrregularUnicodeDetector.style(activity, (Jid) name));
|
||||
} else {
|
||||
viewHolder.binding.conversationName.setText(EmojiWrapper.transform(name));
|
||||
viewHolder.binding.conversationName.setText(name);
|
||||
}
|
||||
|
||||
if (conversation == ConversationFragment.getConversation(activity)) {
|
||||
|
@ -85,7 +84,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte
|
|||
|
||||
if (draft != null) {
|
||||
viewHolder.binding.conversationLastmsgImg.setVisibility(View.GONE);
|
||||
viewHolder.binding.conversationLastmsg.setText(EmojiWrapper.transform(draft.getMessage()));
|
||||
viewHolder.binding.conversationLastmsg.setText(draft.getMessage());
|
||||
viewHolder.binding.senderName.setText(R.string.draft);
|
||||
viewHolder.binding.senderName.setVisibility(View.VISIBLE);
|
||||
viewHolder.binding.conversationLastmsg.setTypeface(null, Typeface.NORMAL);
|
||||
|
@ -128,7 +127,7 @@ public class ConversationAdapter extends RecyclerView.Adapter<ConversationAdapte
|
|||
}
|
||||
final Pair<CharSequence, Boolean> 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);
|
||||
}
|
||||
|
|
|
@ -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<ListItem> {
|
|||
} 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;
|
||||
}
|
||||
|
|
|
@ -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<Message> {
|
|||
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<Message> {
|
|||
}
|
||||
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("");
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -106,7 +106,7 @@
|
|||
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
|
||||
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
|
||||
|
||||
<eu.siacs.conversations.ui.widget.EmojiWrapperEditText
|
||||
<EditText
|
||||
android:id="@+id/muc_edit_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
@ -120,7 +120,7 @@
|
|||
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
|
||||
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
|
||||
|
||||
<eu.siacs.conversations.ui.widget.EmojiWrapperEditText
|
||||
<EditText
|
||||
android:id="@+id/muc_edit_subject"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
|
||||
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
|
||||
|
||||
<eu.siacs.conversations.ui.widget.EmojiWrapperEditText
|
||||
<EditText
|
||||
android:id="@+id/group_chat_name"
|
||||
style="@style/Widget.Conversations.EditText"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
|
||||
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
|
||||
|
||||
<eu.siacs.conversations.ui.widget.EmojiWrapperEditText
|
||||
<EditText
|
||||
android:id="@+id/group_chat_name"
|
||||
style="@style/Widget.Conversations.EditText"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -16,7 +16,7 @@
|
|||
app:errorTextAppearance="@style/TextAppearance.Conversations.Design.Error"
|
||||
app:hintTextAppearance="@style/TextAppearance.Conversations.Design.Hint">
|
||||
|
||||
<eu.siacs.conversations.ui.widget.EmojiWrapperEditText
|
||||
<EditText
|
||||
android:id="@+id/input_edit_text"
|
||||
style="@style/Widget.Conversations.EditText"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -25,7 +25,7 @@
|
|||
android:inputType="textPersonName">
|
||||
|
||||
<requestFocus/>
|
||||
</eu.siacs.conversations.ui.widget.EmojiWrapperEditText>
|
||||
</EditText>
|
||||
|
||||
</com.google.android.material.textfield.TextInputLayout>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package eu.siacs.conversations.services;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class EmojiInitializationService {
|
||||
|
||||
public static void execute(final Context context) {
|
||||
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
|
||||
}
|
|
@ -1,6 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<string-array name="font_certs">
|
||||
<item>MIIEQzCCAyugAwIBAgIJAMLgh0ZkSjCNMA0GCSqGSIb3DQEBBAUAMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDAeFw0wODA4MjEyMzEzMzRaFw0zNjAxMDcyMzEzMzRaMHQxCzAJBgNVBAYTAlVTMRMwEQYDVQQIEwpDYWxpZm9ybmlhMRYwFAYDVQQHEw1Nb3VudGFpbiBWaWV3MRQwEgYDVQQKEwtHb29nbGUgSW5jLjEQMA4GA1UECxMHQW5kcm9pZDEQMA4GA1UEAxMHQW5kcm9pZDCCASAwDQYJKoZIhvcNAQEBBQADggENADCCAQgCggEBAKtWLgDYO6IIrgqWbxJOKdoR8qtW0I9Y4sypEwPpt1TTcvZApxsdyxMJZ2JORland2qSGT2y5b+3JKkedxiLDmpHpDsz2WCbdxgxRczfey5YZnTJ4VZbH0xqWVW/8lGmPav5xVwnIiJS6HXk+BVKZF+JcWjAsb/GEuq/eFdpuzSqeYTcfi6idkyugwfYwXFU1+5fZKUaRKYCwkkFQVfcAs1fXA5V+++FGfvjJ/CxURaSxaBvGdGDhfXE28LWuT9ozCl5xw4Yq5OGazvV24mZVSoOO0yZ31j7kYvtwYK6NeADwbSxDdJEqO4k//0zOHKrUiGYXtqw/A0LFFtqoZKFjnkCAQOjgdkwgdYwHQYDVR0OBBYEFMd9jMIhF1Ylmn/Tgt9r45jk14alMIGmBgNVHSMEgZ4wgZuAFMd9jMIhF1Ylmn/Tgt9r45jk14aloXikdjB0MQswCQYDVQQGEwJVUzETMBEGA1UECBMKQ2FsaWZvcm5pYTEWMBQGA1UEBxMNTW91bnRhaW4gVmlldzEUMBIGA1UEChMLR29vZ2xlIEluYy4xEDAOBgNVBAsTB0FuZHJvaWQxEDAOBgNVBAMTB0FuZHJvaWSCCQDC4IdGZEowjTAMBgNVHRMEBTADAQH/MA0GCSqGSIb3DQEBBAUAA4IBAQBt0lLO74UwLDYKqs6Tm8/yzKkEu116FmH4rkaymUIE0P9KaMftGlMexFlaYjzmB2OxZyl6euNXEsQH8gjwyxCUKRJNexBiGcCEyj6z+a1fuHHvkiaai+KL8W1EyNmgjmyy8AW7P+LLlkR+ho5zEHatRbM/YAnqGcFh5iZBqpknHf1SKMXFh4dd239FJ1jWYfbMDMy3NS5CTMQ2XFI1MvcyUTdZPErjQfTbQe3aDQsQcafEQPD+nqActifKZ0Np0IS9L9kR/wbNvyz6ENwPiTrjV2KRkEjH78ZMcUQXg0L3BYHJ3lc69Vs5Ddf9uUGGMYldX3WfMBEmh/9iFBDAaTCK</item>
|
||||
</string-array>
|
||||
</resources>
|
|
@ -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
|
||||
}
|
||||
}
|
|
@ -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);
|
||||
}
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue