|
@@ -5,7 +5,7 @@ import android.util.AttributeSet
|
|
import android.view.MotionEvent
|
|
import android.view.MotionEvent
|
|
import eu.davidea.fastscroller.FastScroller
|
|
import eu.davidea.fastscroller.FastScroller
|
|
import eu.kanade.tachiyomi.R
|
|
import eu.kanade.tachiyomi.R
|
|
-import eu.kanade.tachiyomi.util.system.dpToPx
|
|
|
|
|
|
+import eu.kanade.tachiyomi.util.system.dpToPxEnd
|
|
|
|
|
|
class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
|
class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) :
|
|
FastScroller(context, attrs) {
|
|
FastScroller(context, attrs) {
|
|
@@ -14,6 +14,8 @@ class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: Attr
|
|
setViewsToUse(
|
|
setViewsToUse(
|
|
R.layout.material_fastscroll, R.id.fast_scroller_bubble, R.id.fast_scroller_handle
|
|
R.layout.material_fastscroll, R.id.fast_scroller_bubble, R.id.fast_scroller_handle
|
|
)
|
|
)
|
|
|
|
+ autoHideEnabled = true
|
|
|
|
+ ignoreTouchesOutsideHandle = true
|
|
}
|
|
}
|
|
|
|
|
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
|
override fun onTouchEvent(event: MotionEvent): Boolean {
|
|
@@ -23,7 +25,9 @@ class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: Attr
|
|
|
|
|
|
override fun setBubbleAndHandlePosition(y: Float) {
|
|
override fun setBubbleAndHandlePosition(y: Float) {
|
|
super.setBubbleAndHandlePosition(y)
|
|
super.setBubbleAndHandlePosition(y)
|
|
- bubble.y = handle.y - bubble.height / 2f + handle.height / 2f
|
|
|
|
- bubble.translationX = (-45).dpToPx.toFloat()
|
|
|
|
|
|
+ if (bubbleEnabled) {
|
|
|
|
+ bubble.y = handle.y - bubble.height / 2f + handle.height / 2f
|
|
|
|
+ bubble.translationX = (-45f).dpToPxEnd
|
|
|
|
+ }
|
|
}
|
|
}
|
|
}
|
|
}
|