feat: instantly scroll to bottom if already smooth scrolling on button tap

fixes #736
This commit is contained in:
Harris 2021-09-21 14:50:25 +10:00
parent 00c2642b47
commit b3a850a876

View File

@ -234,7 +234,14 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
setUpLinkPreviewObserver() setUpLinkPreviewObserver()
restoreDraftIfNeeded() restoreDraftIfNeeded()
addOpenGroupGuidelinesIfNeeded() addOpenGroupGuidelinesIfNeeded()
scrollToBottomButton.setOnClickListener { conversationRecyclerView.smoothScrollToPosition(0) } scrollToBottomButton.setOnClickListener {
val layoutManager = conversationRecyclerView.layoutManager ?: return@setOnClickListener
if (layoutManager.isSmoothScrolling) {
conversationRecyclerView.scrollToPosition(0)
} else {
conversationRecyclerView.smoothScrollToPosition(0)
}
}
unreadCount = DatabaseFactory.getMmsSmsDatabase(this).getUnreadCount(threadID) unreadCount = DatabaseFactory.getMmsSmsDatabase(this).getUnreadCount(threadID)
updateUnreadCountIndicator() updateUnreadCountIndicator()
setUpTypingObserver() setUpTypingObserver()