diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-04-22 14:21:05 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-04-22 14:21:05 +0200 |
commit | 9ab8d4400a215aee4ef5722395d6f06441bc11a1 (patch) | |
tree | a790bbc346347adddaee0476e78ae13c34c89f4a /src | |
parent | 60494b249b13b09319d6ff944935b6dbbf71ba6b (diff) |
show scroll down button instantly when scrolling up
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ConversationFragment.java | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java index b94b80d2a..8e71a028d 100644 --- a/src/main/java/de/pixart/messenger/ui/ConversationFragment.java +++ b/src/main/java/de/pixart/messenger/ui/ConversationFragment.java @@ -212,11 +212,15 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke }; private void toggleScrollDownButton() { - toggleScrollDownButton(binding.messagesView, binding.messagesView.getCount()); + toggleScrollDownButton(binding.messagesView); } - private void toggleScrollDownButton(AbsListView listView, int count) { - if (listView.getLastVisiblePosition() < count - 5) { + private void toggleScrollDownButton(AbsListView listView) { + if (scrolledToBottom(listView)) { + lastMessageUuid = null; + hideUnreadMessagesCount(); + + } else { binding.scrollToBottomButton.setEnabled(true); binding.scrollToBottomButton.setVisibility(View.VISIBLE); if (lastMessageUuid == null) { @@ -225,9 +229,6 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke if (conversation.getReceivedMessagesCountSinceUuid(lastMessageUuid) > 0) { binding.unreadCountCustomView.setVisibility(View.VISIBLE); } - } else if (scrolledToBottom(listView)) { - lastMessageUuid = null; - hideUnreadMessagesCount(); } } @@ -241,7 +242,7 @@ public class ConversationFragment extends XmppFragment implements EditMessage.Ke @Override public void onScroll(final AbsListView view, int firstVisibleItem, int visibleItemCount, final int totalItemCount) { - toggleScrollDownButton(view, totalItemCount); + toggleScrollDownButton(view); synchronized (ConversationFragment.this.messageList) { if (firstVisibleItem < 25 && conversation != null && conversation.messagesLoaded.compareAndSet(true, false) && messageList.size() > 0) { long timestamp; |