diff options
author | steckbrief <steckbrief@chefmail.de> | 2020-04-11 16:38:52 +0200 |
---|---|---|
committer | steckbrief <steckbrief@chefmail.de> | 2020-04-11 16:38:52 +0200 |
commit | de3b30bb34105d74c8a5277edabcbc8bfb65bcc5 (patch) | |
tree | 6d76b5870bfc1ed471bef93b25016cb49b5c7a5b /src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | |
parent | 25434a72dcdd9653130950802a8346fd487ac1c5 (diff) |
Implements FS#309: Rework display of /me messages - Variante 1
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 26 |
1 files changed, 24 insertions, 2 deletions
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 9c6cb5ac9..7e204b665 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -46,6 +46,7 @@ import java.util.Locale; import java.util.regex.Matcher; import java.util.regex.Pattern; +import de.pixart.messenger.BuildConfig; import de.pixart.messenger.Config; import de.pixart.messenger.R; import de.pixart.messenger.crypto.axolotl.FingerprintStatus; @@ -100,6 +101,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie private static final int RECEIVED = 1; private static final int STATUS = 2; private static final int DATE_SEPARATOR = 3; + private static final int VIEWTYPE_ME_COMMAND = 4; boolean isResendable = false; @@ -165,10 +167,13 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie @Override public int getViewTypeCount() { - return 4; + return 5; } private int getItemViewType(Message message) { + if (BuildConfig.FLAVOR_distribution.equalsIgnoreCase("piratx") && message.hasMeCommand()) { + return VIEWTYPE_ME_COMMAND; + } if (message.getType() == Message.TYPE_STATUS) { if (DATE_SEPARATOR_BODY.equals(message.getBody())) { return DATE_SEPARATOR; @@ -962,6 +967,23 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.status_message = view.findViewById(R.id.status_message); viewHolder.load_more_messages = view.findViewById(R.id.load_more_messages); break; + case VIEWTYPE_ME_COMMAND: + view = activity.getLayoutInflater().inflate(R.layout.message_mecmd, parent, false); + viewHolder.message_box = view.findViewById(R.id.message_box); + viewHolder.contact_picture = view.findViewById(R.id.message_photo); + viewHolder.messageBody = view.findViewById(R.id.message_body); + viewHolder.time = view.findViewById(R.id.message_time); + viewHolder.indicator = view.findViewById(R.id.security_indicator); + viewHolder.indicatorReceived = view.findViewById(R.id.indicator_received); + viewHolder.encryption = view.findViewById(R.id.message_encryption); + viewHolder.audioPlayer = view.findViewById(R.id.audio_player); + viewHolder.download_button = view.findViewById(R.id.download_button); + viewHolder.image = view.findViewById(R.id.message_image); + viewHolder.gifImage = view.findViewById(R.id.message_image_gif); + viewHolder.richlinkview = view.findViewById(R.id.richLinkView); + viewHolder.indicatorReceived = view.findViewById(R.id.indicator_received); + viewHolder.indicatorRead = view.findViewById(R.id.indicator_read); + break; default: throw new AssertionError("Unknown view type"); } @@ -1018,7 +1040,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie } return view; } else { - if (message.getStatus() > Message.STATUS_RECEIVED) { + if (message.getStatus() > Message.STATUS_RECEIVED && !message.hasMeCommand()) { view.findViewById(R.id.placeholder).setVisibility(View.GONE); viewHolder.contact_picture.setVisibility(View.GONE); } else { |