reorder and scroll down after resending a message
This commit is contained in:
parent
3bff110587
commit
de2f5e7a83
|
@ -848,16 +848,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();
|
||||
|
|
|
@ -3588,6 +3588,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) {
|
||||
|
|
|
@ -1528,6 +1528,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;
|
||||
}
|
||||
|
@ -1540,7 +1544,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) {
|
||||
final String url;
|
||||
|
|
Loading…
Reference in a new issue