mirror of
https://github.com/nextcloud/talk-android.git
synced 2024-11-22 21:15:30 +03:00
Implemented scroll suggestions from marcel
Signed-off-by: Julius Linus <juliuslinus1@gmail.com>
This commit is contained in:
parent
7ad16c22eb
commit
df3a27a8aa
1 changed files with 1 additions and 9 deletions
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue