aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--src/main/java/de/pixart/messenger/entities/Conversation.java18
-rw-r--r--src/main/java/de/pixart/messenger/services/XmppConnectionService.java2
-rw-r--r--src/main/java/de/pixart/messenger/ui/ConversationFragment.java8
3 files changed, 17 insertions, 11 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Conversation.java b/src/main/java/de/pixart/messenger/entities/Conversation.java
index b41805987..9a856a738 100644
--- a/src/main/java/de/pixart/messenger/entities/Conversation.java
+++ b/src/main/java/de/pixart/messenger/entities/Conversation.java
@@ -17,7 +17,6 @@ import org.json.JSONObject;
import java.security.interfaces.DSAPublicKey;
import java.util.ArrayList;
import java.util.Collections;
-import java.util.Comparator;
import java.util.Iterator;
import java.util.List;
import java.util.ListIterator;
@@ -1017,16 +1016,13 @@ public class Conversation extends AbstractEntity implements Blockable, Comparabl
public void sort() {
synchronized (this.messages) {
- Collections.sort(this.messages, new Comparator<Message>() {
- @Override
- public int compare(Message left, Message right) {
- if (left.getTimeSent() < right.getTimeSent()) {
- return -1;
- } else if (left.getTimeSent() > right.getTimeSent()) {
- return 1;
- } else {
- return 0;
- }
+ Collections.sort(this.messages, (left, right) -> {
+ if (left.getTimeSent() < right.getTimeSent()) {
+ return -1;
+ } else if (left.getTimeSent() > right.getTimeSent()) {
+ return 1;
+ } else {
+ return 0;
}
});
untieMessages();
diff --git a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
index 25ecf8506..afed51f85 100644
--- a/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
+++ b/src/main/java/de/pixart/messenger/services/XmppConnectionService.java
@@ -3947,6 +3947,8 @@ public class XmppConnectionService extends Service {
markMessage(msg, Message.STATUS_WAITING);
this.resendMessage(msg, false);
}
+ message.getConversation().sort();
+ updateConversationUi();
}
public void clearConversationHistory(final Conversation conversation) {
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
index 24bc9163f..568b0db11 100644
--- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
+++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java
@@ -1800,6 +1800,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
activity.selectPresence(conversation, () -> {
message.setCounterpart(conversation.getNextCounterpart());
activity.xmppConnectionService.resendFailedMessages(message);
+ new Handler().post(() -> {
+ int size = messageList.size();
+ this.binding.messagesView.setSelection(size - 1);
+ });
});
return;
}
@@ -1812,6 +1816,10 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke
}
}
activity.xmppConnectionService.resendFailedMessages(message);
+ new Handler().post(() -> {
+ int size = messageList.size();
+ this.binding.messagesView.setSelection(size - 1);
+ });
}
private void copyUrl(Message message) {