Implemented scroll suggestions from marcel

Signed-off-by: Julius Linus <juliuslinus1@gmail.com>
This commit is contained in:
rapterjet2004 2023-02-04 17:39:15 -06:00 committed by Andy Scherzinger
parent 7ad16c22eb
commit df3a27a8aa
No known key found for this signature in database
GPG key ID: 6CADC7E3523C308B

View file

@ -685,16 +685,8 @@ class ChatController(args: Bundle) :
if (newState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
val offset = recyclerView.computeVerticalScrollOffset()
val extent = recyclerView.computeVerticalScrollExtent()
val range = recyclerView.computeVerticalScrollRange()
// 0.0 is the top of the chat, 100.0 is the bottom of the chat
val scrollPercentage = 100.0f * offset / (range - extent).toFloat()
if (scrollPercentage <= 90) {
if (layoutManager!!.findFirstCompletelyVisibleItemPosition() > 0) {
binding?.scrollDownButton?.visibility = View.VISIBLE
} else {
binding?.scrollDownButton?.visibility = View.INVISIBLE
}