You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Dec 22, 2023. It is now read-only.
* [u] Kotlin from `1.3.41` to `1.2.50`
* [M] Making Compile SDK to 28
* [M] Migrating `AppCompat` usage to `AndroidX`
* [u] Android Gradle plugin to `3.4.1` from `3.1.3`
* [r] Bumped library version to `0.1.2-alpha`
* [r] Fixing lint errors on RecyclerViewFastScroller.kt
if (Math.abs(touchRelativeOffset)>handleImageView.height) touchRelativeOffset =0f
282
+
if (abs(touchRelativeOffset)>handleImageView.height) touchRelativeOffset =0f
278
283
279
284
//set the engaged flag to prevent the handle from scrolling again as the OnScrolled event in the ScrollListener is called even for programmatic scrolls
280
285
isEngaged =true
@@ -300,7 +305,7 @@ class RecyclerViewFastScroller @JvmOverloads constructor(
300
305
if (motionEvent.action ==MotionEvent.ACTION_MOVE){
@@ -448,9 +453,11 @@ class RecyclerViewFastScroller @JvmOverloads constructor(
448
453
* else uses the standard [RecyclerView.LayoutManager.scrollToPosition] method. The offset in [LinearLayoutManager] is the position where the view should be after scrolling relative to the [RecyclerView]
val position =Math.min(recyclerViewItemCount, Math.max(0, Math.round(newOffset * (recyclerViewItemCount - totalVisibleItems))))
487
+
val position = min(recyclerViewItemCount, max(0, (newOffset * (recyclerViewItemCount - totalVisibleItems)).roundToInt()))
481
488
482
-
val toScrollPosition =Math.min((this.adapter?.itemCount?:0)-(previousTotalVisibleItem+1), position)
489
+
val toScrollPosition = min((this.adapter?.itemCount?:0)-(previousTotalVisibleItem+1), position)
483
490
safeScrollToPosition(toScrollPosition)
484
491
return position
485
492
}
486
493
else-> {
487
494
488
-
val position =Math.round(newOffset * recyclerViewItemCount)
495
+
val position = (newOffset * recyclerViewItemCount).roundToInt()
489
496
safeScrollToPosition(position)
490
497
return position
491
498
}
@@ -498,26 +505,23 @@ class RecyclerViewFastScroller @JvmOverloads constructor(
498
505
privatefunupdateTextInPopup(position:Int){
499
506
if (position !in0 until (recyclerView.adapter?.itemCount?:1)) { return }
500
507
501
-
val adapter = recyclerView.adapter
502
-
when (adapter){
508
+
when (val adapter = recyclerView.adapter){
509
+
null-> {throwIllegalAccessException("No adapter found, if you have an adapter then try placing if before calling the attachFastScrollerToRecyclerView() method")}
null-> {throwIllegalAccessException("No adapter found, if you have an adapter then try placing if before calling the attachFastScrollerToRecyclerView() method")}
506
512
else-> { throwIllegalAccessException("Should implement the OnPopupTextUpdate or OnPopupViewUpdate interface")}
0 commit comments