diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-05-04 15:37:16 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-05-04 15:37:16 +0200 |
commit | 5d6876e3131c620c3dbcf840c9395fe796c42a5f (patch) | |
tree | a92818bd9b5b5c17b32c9140bd7d71844d0fba6b /src/main/java/de/pixart/messenger | |
parent | 3abd3091ac6aa01b76bca5c6b17023d45fb084b8 (diff) |
small message optimizations
Diffstat (limited to '')
3 files changed, 12 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 61ed8af6d..2a864f914 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -614,10 +614,10 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable !this.treatAsDownloadable() && !message.getBody().startsWith(ME_COMMAND) && !this.getBody().startsWith(ME_COMMAND) && - !this.bodyIsOnlyEmojis() && !message.bodyIsOnlyEmojis() && - !this.isXmppUri() && + !this.bodyIsOnlyEmojis() && !message.isXmppUri() && + !this.isXmppUri() && ((this.axolotlFingerprint == null && message.axolotlFingerprint == null) || this.axolotlFingerprint.equals(message.getFingerprint())) && UIHelper.sameDay(message.getTimeSent(), this.getTimeSent()) && this.getReadByMarkers().equals(message.getReadByMarkers()) && diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index d16fad5c5..eeb0b8e18 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -253,7 +253,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke public void onScroll(final AbsListView view, int firstVisibleItem, int visibleItemCount, final int totalItemCount) { toggleScrollDownButton(view); synchronized (ConversationFragment.this.messageList) { - if (firstVisibleItem < 25 && conversation != null && conversation.messagesLoaded.compareAndSet(true, false) && messageList.size() > 0) { + if (firstVisibleItem < 5 && conversation != null && conversation.messagesLoaded.compareAndSet(true, false) && messageList.size() > 0) { long timestamp; if (messageList.get(0).getType() == Message.TYPE_STATUS && messageList.size() >= 2) { timestamp = messageList.get(1).getTimeSent(); 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 fcc317de9..4cdefccc3 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -691,7 +691,6 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.image.setVisibility(View.GONE); viewHolder.gifImage.setVisibility(View.GONE); Editable body = new SpannableStringBuilder(message.getBody()); - listSelectionManager.onUpdate(viewHolder.messageBody, message); final boolean dataSaverDisabled = activity.xmppConnectionService.isDataSaverDisabled(); viewHolder.richlinkview.setVisibility(View.VISIBLE); if (mShowLinksInside) { @@ -863,27 +862,29 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie privateMarker = activity.getString(R.string.private_message_to, Strings.nullToEmpty(cp == null ? null : cp.getResource())); } body = new SpannableStringBuilder(privateMarker); + viewHolder.messageBody.setVisibility(View.VISIBLE); if (includeBody) { body.append("\n"); body.append(message.getBody()); - MyLinkify.addLinks(body, false); - viewHolder.messageBody.setAutoLinkMask(0); - viewHolder.messageBody.setTextIsSelectable(true); - viewHolder.messageBody.setMovementMethod(ClickableMovementMethod.getInstance()); } body.setSpan(new ForegroundColorSpan(getMessageTextColor(darkBackground, false)), 0, privateMarker.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); body.setSpan(new StyleSpan(Typeface.BOLD), 0, privateMarker.length(), Spannable.SPAN_EXCLUSIVE_EXCLUSIVE); + MyLinkify.addLinks(body, false); + viewHolder.messageBody.setAutoLinkMask(0); viewHolder.messageBody.setText(body); - viewHolder.messageBody.setVisibility(View.VISIBLE); + viewHolder.messageBody.setTextIsSelectable(true); + viewHolder.messageBody.setMovementMethod(ClickableMovementMethod.getInstance()); + listSelectionManager.onUpdate(viewHolder.messageBody, message); } else { if (includeBody) { + viewHolder.messageBody.setVisibility(View.VISIBLE); body = new SpannableStringBuilder(message.getBody()); MyLinkify.addLinks(body, false); - viewHolder.messageBody.setVisibility(View.VISIBLE); - viewHolder.messageBody.setText(body); viewHolder.messageBody.setAutoLinkMask(0); + viewHolder.messageBody.setText(body); viewHolder.messageBody.setTextIsSelectable(true); viewHolder.messageBody.setMovementMethod(ClickableMovementMethod.getInstance()); + listSelectionManager.onUpdate(viewHolder.messageBody, message); } else { viewHolder.messageBody.setVisibility(View.GONE); } |