diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt new file mode 100644 index 000000000..acfd78c4b --- /dev/null +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt @@ -0,0 +1,29 @@ +package eu.kanade.tachiyomi.ui.library + +import android.content.Context +import android.util.AttributeSet +import android.view.MotionEvent +import eu.davidea.fastscroller.FastScroller +import eu.kanade.tachiyomi.R +import eu.kanade.tachiyomi.util.system.dpToPx + +class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: AttributeSet? = null) : + FastScroller(context, attrs) { + + init { + setViewsToUse( + R.layout.material_fastscroll, R.id.fast_scroller_bubble, R.id.fast_scroller_handle + ) + } + + override fun onTouchEvent(event: MotionEvent): Boolean { + if (isHidden) return false + return super.onTouchEvent(event) + } + + override fun setBubbleAndHandlePosition(y: Float) { + super.setBubbleAndHandlePosition(y) + bubble.y = handle.y - bubble.height / 2f + handle.height / 2f + bubble.translationX = (-45).dpToPx.toFloat() + } +} diff --git a/app/src/main/res/drawable/material_bubble_drawable.xml b/app/src/main/res/drawable/material_bubble_drawable.xml new file mode 100644 index 000000000..aec5abefe --- /dev/null +++ b/app/src/main/res/drawable/material_bubble_drawable.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/app/src/main/res/drawable/material_thumb_drawable.xml b/app/src/main/res/drawable/material_thumb_drawable.xml new file mode 100644 index 000000000..2e550c0df --- /dev/null +++ b/app/src/main/res/drawable/material_thumb_drawable.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/chapters_controller.xml b/app/src/main/res/layout/chapters_controller.xml index 318f119c1..b56700a8e 100644 --- a/app/src/main/res/layout/chapters_controller.xml +++ b/app/src/main/res/layout/chapters_controller.xml @@ -34,7 +34,7 @@ - - - + + + + + + + + + + + + + + + diff --git a/app/src/main/res/layout/source_main_controller.xml b/app/src/main/res/layout/source_main_controller.xml index accfafcfe..1b831eb5b 100644 --- a/app/src/main/res/layout/source_main_controller.xml +++ b/app/src/main/res/layout/source_main_controller.xml @@ -11,7 +11,7 @@ android:layout_height="wrap_content" tools:listitem="@layout/source_main_controller_card_header" /> -