avoid unnecessary recyclerview.scrollby calls at the fastscroller
This commit is contained in:
parent
c9c5682bc1
commit
4c93c0a510
1 changed files with 8 additions and 2 deletions
|
@ -298,14 +298,20 @@ class FastScroller : FrameLayout {
|
|||
val movePercent = diffInMove / (recyclerViewWidth.toFloat() - handleWidth)
|
||||
val target = (recyclerViewContentWidth - recyclerViewWidth) * movePercent
|
||||
val diff = target.toInt() - currScrollX
|
||||
recyclerView!!.scrollBy(diff, 0)
|
||||
|
||||
if (diff != 0) {
|
||||
recyclerView!!.scrollBy(diff, 0)
|
||||
}
|
||||
} else {
|
||||
targetProportion = currScrollY / recyclerViewContentHeight.toFloat()
|
||||
val diffInMove = pos - handleYOffset
|
||||
val movePercent = diffInMove / (recyclerViewHeight.toFloat() - handleHeight)
|
||||
val target = (recyclerViewContentHeight - recyclerViewHeight) * movePercent
|
||||
val diff = target.toInt() - currScrollY
|
||||
recyclerView!!.scrollBy(0, diff)
|
||||
|
||||
if (diff != 0) {
|
||||
recyclerView!!.scrollBy(0, diff)
|
||||
}
|
||||
}
|
||||
|
||||
val itemCount = recyclerView!!.adapter!!.itemCount
|
||||
|
|
Loading…
Reference in a new issue