improve scroll to bottom button behavior
This commit is contained in:
parent
42a57ca532
commit
82b4208304
|
@ -226,7 +226,7 @@ public class ConversationFragment extends XmppFragment
|
|||
@ColorInt
|
||||
private int primaryColor = -1;
|
||||
|
||||
private LinkedList<Message> replyJumps = new LinkedList<>();
|
||||
private Message previousClickedReply = null;
|
||||
|
||||
private ActionMode selectionActionMode;
|
||||
private final OnClickListener clickToMuc =
|
||||
|
@ -590,14 +590,12 @@ public class ConversationFragment extends XmppFragment
|
|||
public void onClick(View v) {
|
||||
stopScrolling();
|
||||
|
||||
if (!replyJumps.isEmpty()) {
|
||||
if (previousClickedReply != null) {
|
||||
int lastVisiblePosition = binding.messagesView.getLastVisiblePosition();
|
||||
Message lastVisibleMessage = messageListAdapter.getItem(lastVisiblePosition);
|
||||
if (lastVisibleMessage == null) {
|
||||
replyJumps.clear();
|
||||
} else {
|
||||
while (!replyJumps.isEmpty()) {
|
||||
Message jump = replyJumps.pop();
|
||||
Message jump = previousClickedReply;
|
||||
previousClickedReply = null;
|
||||
if (lastVisibleMessage != null) {
|
||||
if (jump.getMergedTimeSent() > lastVisibleMessage.getMergedTimeSent()) {
|
||||
Runnable postSelectionRunnable = () -> highlightMessage(jump.getUuid());
|
||||
updateSelection(jump.getUuid(), binding.messagesView.getHeight() / 2, postSelectionRunnable, false, false);
|
||||
|
@ -605,7 +603,6 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (conversation.isInHistoryPart()) {
|
||||
conversation.jumpToLatest();
|
||||
|
@ -1592,7 +1589,7 @@ public class ConversationFragment extends XmppFragment
|
|||
|
||||
if (replyId != null) {
|
||||
Runnable postSelectionRunnable = () -> highlightMessage(replyId);
|
||||
replyJumps.push(message);
|
||||
previousClickedReply = message;
|
||||
updateSelection(replyId, binding.messagesView.getHeight() / 2, postSelectionRunnable, true, false);
|
||||
}
|
||||
}
|
||||
|
@ -3075,7 +3072,7 @@ public class ConversationFragment extends XmppFragment
|
|||
refreshCommands();
|
||||
}
|
||||
|
||||
replyJumps.clear();
|
||||
previousClickedReply = null;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
@ -3128,7 +3125,7 @@ public class ConversationFragment extends XmppFragment
|
|||
}
|
||||
this.binding.scrollToBottomButton.setEnabled(false);
|
||||
this.binding.scrollToBottomButton.hide();
|
||||
replyJumps.clear();
|
||||
previousClickedReply = null;
|
||||
this.binding.unreadCountCustomView.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue