From 36033690b4c6f8b702cd77074cb7a74d0dcde5ca Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Mon, 1 Oct 2018 08:12:11 +0200 Subject: fix crashes with EmojiTextView --- .../java/de/pixart/messenger/ui/ConferenceDetailsActivity.java | 8 ++++---- src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java | 5 +++-- src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java | 6 +++--- src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 2 +- src/main/res/layout/ab_title.xml | 4 ++-- src/main/res/layout/activity_contact_details.xml | 6 +++--- src/main/res/layout/activity_muc_details.xml | 2 +- src/main/res/layout/contact.xml | 2 +- 8 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java index 1b406b887..fb40500cf 100644 --- a/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ConferenceDetailsActivity.java @@ -590,7 +590,7 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers } else { this.binding.mucSubject.setVisibility(View.GONE); } - this.binding.mucYourNick.setText(mucOptions.getActualNick()); + this.binding.mucYourNick.setText(EmojiWrapper.transform(mucOptions.getActualNick())); if (mucOptions.online()) { this.binding.mucMoreDetails.setVisibility(View.VISIBLE); this.binding.mucSettings.setVisibility(View.VISIBLE); @@ -704,10 +704,10 @@ public class ConferenceDetailsActivity extends XmppActivity implements OnConvers Contact contact = user.getContact(); String name = user.getName(); if (contact != null) { - binding.contactDisplayName.setText(contact.getDisplayName()); - binding.contactJid.setText((name != null ? name + " \u2022 " : "") + getStatus(user)); + binding.contactDisplayName.setText(EmojiWrapper.transform(contact.getDisplayName())); + binding.contactJid.setText((name != null ? EmojiWrapper.transform(name) + " \u2022 " : "") + getStatus(user)); } else { - binding.contactDisplayName.setText(name == null ? "" : name); + binding.contactDisplayName.setText(name == null ? "" : EmojiWrapper.transform(name)); binding.contactJid.setText(getStatus(user)); } diff --git a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java index 1dfc80e3c..147b8b4fe 100644 --- a/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ContactDetailsActivity.java @@ -53,6 +53,7 @@ import de.pixart.messenger.ui.util.Attachment; import de.pixart.messenger.ui.util.GridManager; import de.pixart.messenger.utils.Compatibility; import de.pixart.messenger.utils.CryptoHelper; +import de.pixart.messenger.utils.EmojiWrapper; import de.pixart.messenger.utils.IrregularUnicodeDetector; import de.pixart.messenger.utils.MenuDoubleTabUtil; import de.pixart.messenger.utils.Namespace; @@ -393,7 +394,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp ab.setDisplayShowCustomEnabled(true); TextView abtitle = findViewById(android.R.id.text1); TextView absubtitle = findViewById(android.R.id.text2); - abtitle.setText(contact.getDisplayName()); + abtitle.setText(EmojiWrapper.transform(contact.getDisplayName())); abtitle.setSelected(true); abtitle.setClickable(false); absubtitle.setVisibility(View.GONE); @@ -443,7 +444,7 @@ public class ContactDetailsActivity extends OmemoActivity implements OnAccountUp builder.append("\n"); } } - binding.statusMessage.setText(builder); + binding.statusMessage.setText(EmojiWrapper.transform(builder)); } String resources = contact.getPresences().getMostAvailableResource(); diff --git a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java index 17479cf99..e99353f13 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/ListItemAdapter.java @@ -8,7 +8,6 @@ import android.graphics.drawable.BitmapDrawable; import android.graphics.drawable.Drawable; import android.os.AsyncTask; import android.preference.PreferenceManager; -import android.support.text.emoji.widget.EmojiTextView; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; @@ -28,6 +27,7 @@ import de.pixart.messenger.entities.ListItem; import de.pixart.messenger.ui.SettingsActivity; import de.pixart.messenger.ui.XmppActivity; import de.pixart.messenger.ui.util.StyledAttributes; +import de.pixart.messenger.utils.EmojiWrapper; import de.pixart.messenger.utils.IrregularUnicodeDetector; import de.pixart.messenger.utils.UIHelper; import rocks.xmpp.addr.Jid; @@ -97,7 +97,7 @@ public class ListItemAdapter extends ArrayAdapter { } else { viewHolder.jid.setVisibility(View.GONE); } - viewHolder.name.setText(item.getDisplayName()); + viewHolder.name.setText(EmojiWrapper.transform(item.getDisplayName())); if (tags.size() != 0) { for (ListItem.Tag tag : tags) { offline = tag.getOffline() == 1; @@ -220,7 +220,7 @@ public class ListItemAdapter extends ArrayAdapter { } private static class ViewHolder { - private EmojiTextView name; + private TextView name; private TextView jid; private ImageView avatar; private FlowLayout tags; diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index b13ccb910..0dd5ffffa 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -839,7 +839,7 @@ public class MessageAdapter extends ArrayAdapter implements CopyTextVie } else { viewHolder.status_message.setVisibility(View.VISIBLE); viewHolder.load_more_messages.setVisibility(View.GONE); - viewHolder.status_message.setText(message.getBody()); + viewHolder.status_message.setText(EmojiWrapper.transform(message.getBody())); boolean showAvatar; if (conversation.getMode() == Conversation.MODE_SINGLE) { showAvatar = true; diff --git a/src/main/res/layout/ab_title.xml b/src/main/res/layout/ab_title.xml index a20e9f8bc..79c9d61f7 100644 --- a/src/main/res/layout/ab_title.xml +++ b/src/main/res/layout/ab_title.xml @@ -5,7 +5,7 @@ android:layout_height="match_parent" android:gravity="start|center_vertical"> - - - - - - -