diff --git a/app/build.gradle b/app/build.gradle index f40fbaafe..e62d6e7ed 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -138,6 +138,7 @@ dependencies { implementation 'com.google.android.material:material:1.0.0' implementation 'androidx.constraintlayout:constraintlayout:2.0.0-beta1' implementation 'com.github.vanniktech:Emoji:0.6.0' + implementation group: 'androidx.emoji', name: 'emoji-bundled', version: '1.0.0' implementation 'org.michaelevans.colorart:library:0.0.3' implementation "android.arch.work:work-runtime:${workVersion}" implementation "android.arch.work:work-rxjava2:${workVersion}" diff --git a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.java b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.java index 1196a8211..8e0e9f19c 100644 --- a/app/src/main/java/com/nextcloud/talk/activities/MainActivity.java +++ b/app/src/main/java/com/nextcloud/talk/activities/MainActivity.java @@ -26,30 +26,27 @@ import android.content.Intent; import android.os.Build; import android.os.Bundle; import android.view.ViewGroup; - import androidx.annotation.RequiresApi; import androidx.appcompat.widget.Toolbar; import autodagger.AutoInjector; import butterknife.BindView; import butterknife.ButterKnife; - import com.bluelinelabs.conductor.Conductor; -import com.bluelinelabs.conductor.Controller; import com.bluelinelabs.conductor.Router; import com.bluelinelabs.conductor.RouterTransaction; import com.bluelinelabs.conductor.changehandler.HorizontalChangeHandler; import com.bluelinelabs.conductor.changehandler.VerticalChangeHandler; import com.nextcloud.talk.R; import com.nextcloud.talk.application.NextcloudTalkApplication; -import com.nextcloud.talk.controllers.*; +import com.nextcloud.talk.controllers.CallNotificationController; +import com.nextcloud.talk.controllers.ConversationsListController; +import com.nextcloud.talk.controllers.LockedController; +import com.nextcloud.talk.controllers.ServerSelectionController; import com.nextcloud.talk.controllers.base.providers.ActionBarProvider; import com.nextcloud.talk.utils.ConductorRemapping; import com.nextcloud.talk.utils.SecurityUtils; import com.nextcloud.talk.utils.bundle.BundleKeys; import com.nextcloud.talk.utils.database.user.UserUtils; - -import java.util.List; - import io.requery.Persistable; import io.requery.android.sqlcipher.SqlCipherDatabaseSource; import io.requery.reactivex.ReactiveEntityStore; diff --git a/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java b/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java index 49af844b3..050a49165 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/items/ConversationItem.java @@ -280,13 +280,13 @@ public class ConversationItem extends AbstractFlexibleItem 0) { for (String key : messageParameters.keySet()) { @@ -177,13 +177,13 @@ public class MagicIncomingTextMessageViewHolder } } else if (TextMatchers.isMessageWithSingleEmoticonOnly(message.getText())) { - emojiSize *= 2.5f; + textSize = (float) (textSize * 2.5); layoutParams.setWrapBefore(true); itemView.setSelected(true); messageAuthor.setVisibility(View.GONE); } - messageText.setEmojiSize((int) emojiSize, true); + messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); messageTimeView.setLayoutParams(layoutParams); messageText.setText(messageString); } diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.java index 755243b20..9d8b886e0 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicOutcomingTextMessageViewHolder.java @@ -27,6 +27,7 @@ import android.graphics.drawable.Drawable; import android.net.Uri; import android.text.Spannable; import android.text.SpannableString; +import android.util.TypedValue; import android.view.View; import android.widget.TextView; import androidx.core.view.ViewCompat; @@ -41,7 +42,6 @@ import com.nextcloud.talk.utils.DisplayUtils; import com.nextcloud.talk.utils.TextMatchers; import com.nextcloud.talk.utils.database.user.UserUtils; import com.stfalcon.chatkit.messages.MessageHolders; -import com.vanniktech.emoji.EmojiTextView; import javax.inject.Inject; import java.util.HashMap; @@ -50,7 +50,7 @@ import java.util.Map; @AutoInjector(NextcloudTalkApplication.class) public class MagicOutcomingTextMessageViewHolder extends MessageHolders.OutcomingTextMessageViewHolder { @BindView(R.id.messageText) - EmojiTextView messageText; + TextView messageText; @BindView(R.id.messageTime) TextView messageTimeView; @@ -85,7 +85,7 @@ public class MagicOutcomingTextMessageViewHolder extends MessageHolders.Outcomin FlexboxLayout.LayoutParams layoutParams = (FlexboxLayout.LayoutParams) messageTimeView.getLayoutParams(); layoutParams.setWrapBefore(false); - float emojiSize = DisplayUtils.getDefaultEmojiFontSize(messageText); + float textSize = context.getResources().getDimension(R.dimen.chat_text_size); if (messageParameters != null && messageParameters.size() > 0) { for (String key : messageParameters.keySet()) { @@ -122,7 +122,7 @@ public class MagicOutcomingTextMessageViewHolder extends MessageHolders.Outcomin } } else if (TextMatchers.isMessageWithSingleEmoticonOnly(message.getText())) { - emojiSize *= 2.5f; + textSize = (float) (textSize * 2.5); layoutParams.setWrapBefore(true); messageTimeView.setTextColor(context.getResources().getColor(R.color.warm_grey_four)); itemView.setSelected(true); @@ -141,7 +141,7 @@ public class MagicOutcomingTextMessageViewHolder extends MessageHolders.Outcomin ViewCompat.setBackground(bubble, bubbleDrawable); } - messageText.setEmojiSize((int) emojiSize, true); + messageText.setTextSize(TypedValue.COMPLEX_UNIT_PX, textSize); messageTimeView.setLayoutParams(layoutParams); messageText.setText(messageString); } diff --git a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java index f5689b6a9..2de44f4d5 100644 --- a/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java +++ b/app/src/main/java/com/nextcloud/talk/adapters/messages/MagicPreviewMessageViewHolder.java @@ -29,6 +29,7 @@ import android.graphics.drawable.LayerDrawable; import android.net.Uri; import android.os.Handler; import android.view.View; +import android.widget.TextView; import autodagger.AutoInjector; import butterknife.BindView; import butterknife.ButterKnife; @@ -44,11 +45,8 @@ import com.nextcloud.talk.utils.DisplayUtils; import com.nextcloud.talk.utils.DrawableUtils; import com.nextcloud.talk.utils.bundle.BundleKeys; import com.stfalcon.chatkit.messages.MessageHolders; -import com.vanniktech.emoji.EmojiTextView; -import io.reactivex.Scheduler; import io.reactivex.Single; import io.reactivex.SingleObserver; -import io.reactivex.android.schedulers.AndroidSchedulers; import io.reactivex.disposables.Disposable; import io.reactivex.schedulers.Schedulers; import okhttp3.OkHttpClient; @@ -61,7 +59,7 @@ import java.util.concurrent.Callable; public class MagicPreviewMessageViewHolder extends MessageHolders.IncomingImageMessageViewHolder { @BindView(R.id.messageText) - EmojiTextView messageText; + TextView messageText; @Inject Context context; diff --git a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java index 3562b4c72..350295ba6 100644 --- a/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java +++ b/app/src/main/java/com/nextcloud/talk/application/NextcloudTalkApplication.java @@ -23,6 +23,8 @@ package com.nextcloud.talk.application; import android.content.Context; import android.os.Build; import android.util.Log; +import androidx.emoji.bundled.BundledEmojiCompatConfig; +import androidx.emoji.text.EmojiCompat; import androidx.lifecycle.LifecycleObserver; import androidx.multidex.MultiDex; import androidx.multidex.MultiDexApplication; @@ -53,7 +55,7 @@ import com.nextcloud.talk.utils.database.user.UserModule; import com.nextcloud.talk.utils.singletons.MerlinTheWizard; import com.nextcloud.talk.webrtc.MagicWebRTCUtils; import com.vanniktech.emoji.EmojiManager; -import com.vanniktech.emoji.twitter.TwitterEmojiProvider; +import com.vanniktech.emoji.googlecompat.GoogleCompatEmojiProvider; import okhttp3.OkHttpClient; import org.conscrypt.Conscrypt; import org.webrtc.PeerConnectionFactory; @@ -159,7 +161,11 @@ public class NextcloudTalkApplication extends MultiDexApplication implements Lif WorkManager.getInstance().enqueue(signalingSettingsWork); WorkManager.getInstance().enqueueUniquePeriodicWork("DailyCapabilitiesUpdateWork", ExistingPeriodicWorkPolicy.REPLACE, periodicCapabilitiesUpdateWork); - EmojiManager.install(new TwitterEmojiProvider()); + final EmojiCompat.Config config = new BundledEmojiCompatConfig(this); + config.setReplaceAll(true); + EmojiCompat emojiCompat = EmojiCompat.init(config); + + EmojiManager.install(new GoogleCompatEmojiProvider(emojiCompat)); } diff --git a/app/src/main/java/com/nextcloud/talk/callbacks/MentionAutocompleteCallback.java b/app/src/main/java/com/nextcloud/talk/callbacks/MentionAutocompleteCallback.java index aef43a89c..ad6e78101 100644 --- a/app/src/main/java/com/nextcloud/talk/callbacks/MentionAutocompleteCallback.java +++ b/app/src/main/java/com/nextcloud/talk/callbacks/MentionAutocompleteCallback.java @@ -23,7 +23,7 @@ package com.nextcloud.talk.callbacks; import android.content.Context; import android.text.Editable; import android.text.Spanned; -import android.text.style.DynamicDrawableSpan; +import android.widget.EditText; import com.facebook.widget.text.span.BetterImageSpan; import com.nextcloud.talk.R; import com.nextcloud.talk.models.database.UserEntity; @@ -32,18 +32,17 @@ import com.nextcloud.talk.utils.DisplayUtils; import com.nextcloud.talk.utils.MagicCharPolicy; import com.nextcloud.talk.utils.text.Spans; import com.otaliastudios.autocomplete.AutocompleteCallback; -import com.vanniktech.emoji.EmojiEditText; public class MentionAutocompleteCallback implements AutocompleteCallback { private Context context; private UserEntity conversationUser; - private EmojiEditText emojiEditText; + private EditText editText; public MentionAutocompleteCallback(Context context, UserEntity conversationUser, - EmojiEditText emojiEditText) { + EditText editText) { this.context = context; this.conversationUser = conversationUser; - this.emojiEditText = emojiEditText; + this.editText = editText; } @Override @@ -57,7 +56,7 @@ public class MentionAutocompleteCallback implements AutocompleteCallback= Build.VERSION_CODES.M) { Configuration config = context.getResources().getConfiguration(); diff --git a/app/src/main/java/com/nextcloud/talk/utils/EmojiToolbar.java b/app/src/main/java/com/nextcloud/talk/utils/EmojiToolbar.java deleted file mode 100644 index 0c435ed40..000000000 --- a/app/src/main/java/com/nextcloud/talk/utils/EmojiToolbar.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Nextcloud Talk application - * - * @author Mario Danic - * Copyright (C) 2017-2018 Mario Danic - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation, either version 3 of the License, or - * at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - */ - -package com.nextcloud.talk.utils; - -import android.content.Context; -import android.text.TextUtils; -import android.util.AttributeSet; -import androidx.annotation.Nullable; -import androidx.appcompat.widget.Toolbar; -import com.nextcloud.talk.R; -import com.vanniktech.emoji.EmojiTextView; - -public class EmojiToolbar extends Toolbar { - private EmojiTextView emojiTitleTextView; - - public EmojiToolbar(Context context) { - super(context); - initEmojiTextView(context, null); - - } - - public EmojiToolbar(Context context, @Nullable AttributeSet attrs) { - super(context, attrs); - initEmojiTextView(context, attrs); - } - - public EmojiToolbar(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initEmojiTextView(context, attrs); - } - - private void initEmojiTextView(Context context, @Nullable AttributeSet attrs) { - if (emojiTitleTextView == null) { - emojiTitleTextView = new EmojiTextView(context, attrs); - emojiTitleTextView.setSingleLine(true); - emojiTitleTextView.setEllipsize(TextUtils.TruncateAt.END); - emojiTitleTextView.setTextAppearance(getContext(), R.style.TextAppearance_AppCompat_Widget_ActionBar_Title); - addView(emojiTitleTextView); - } - } - - @Override - public void setTitle(CharSequence title) { - emojiTitleTextView.setText(title); - } - - @Override - public void setTitle(int titleRes) { - emojiTitleTextView.setText(titleRes); - } -} diff --git a/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java b/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java index bdc875ac1..f8421980a 100644 --- a/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java +++ b/app/src/main/java/com/nextcloud/talk/webrtc/MagicPeerConnectionWrapper.java @@ -26,8 +26,6 @@ import android.text.TextUtils; import android.util.Log; import androidx.annotation.Nullable; import autodagger.AutoInjector; - -import com.bluelinelabs.logansquare.ConverterUtils; import com.bluelinelabs.logansquare.LoganSquare; import com.nextcloud.talk.R; import com.nextcloud.talk.application.NextcloudTalkApplication; @@ -39,7 +37,6 @@ import com.nextcloud.talk.models.json.signaling.DataChannelMessage; import com.nextcloud.talk.models.json.signaling.DataChannelMessageNick; import com.nextcloud.talk.models.json.signaling.NCIceCandidate; import com.nextcloud.talk.utils.LoggingUtils; -import com.nextcloud.talk.utils.singletons.MerlinTheWizard; import org.greenrobot.eventbus.EventBus; import org.webrtc.*; diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index 262467fab..0e770394a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -29,7 +29,7 @@ android:layout_width="match_parent" android:layout_height="wrap_content"> - - - - - - - - - - - - -