mirror of
https://github.com/nextcloud/talk-android
synced 2025-07-17 09:45:02 +01:00
Implemented scroll suggestions from marcel
Signed-off-by: Julius Linus <juliuslinus1@gmail.com>
This commit is contained in:
parent
7ad16c22eb
commit
df3a27a8aa
@ -685,16 +685,8 @@ class ChatController(args: Bundle) :
|
|||||||
|
|
||||||
if (newState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
|
if (newState == AbsListView.OnScrollListener.SCROLL_STATE_IDLE) {
|
||||||
|
|
||||||
val offset = recyclerView.computeVerticalScrollOffset()
|
if (layoutManager!!.findFirstCompletelyVisibleItemPosition() > 0) {
|
||||||
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) {
|
|
||||||
binding?.scrollDownButton?.visibility = View.VISIBLE
|
binding?.scrollDownButton?.visibility = View.VISIBLE
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
binding?.scrollDownButton?.visibility = View.INVISIBLE
|
binding?.scrollDownButton?.visibility = View.INVISIBLE
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user