From 8c394a4a7b49db1b363a0c2928aed2c717b176ab Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 7 May 2020 15:05:09 -0400 Subject: [PATCH] Refactoring fast scroll and its text view using the new textview in the manga details fast scroll --- .../ui/library/MaterialFastScroll.kt | 8 +++-- .../res/layout/library_list_controller.xml | 30 ++++++------------- .../res/layout/manga_details_controller.xml | 14 ++++----- .../main/res/layout/material_fastscroll.xml | 11 +------ app/src/main/res/values/styles.xml | 13 ++++++++ 5 files changed, 34 insertions(+), 42 deletions(-) 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 index a01ed62b96..fee9c6209f 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/library/MaterialFastScroll.kt @@ -14,6 +14,8 @@ class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: Attr setViewsToUse( R.layout.material_fastscroll, R.id.fast_scroller_bubble, R.id.fast_scroller_handle ) + autoHideEnabled = true + ignoreTouchesOutsideHandle = true } override fun onTouchEvent(event: MotionEvent): Boolean { @@ -23,7 +25,9 @@ class MaterialFastScroll @JvmOverloads constructor(context: Context, attrs: Attr override fun setBubbleAndHandlePosition(y: Float) { super.setBubbleAndHandlePosition(y) - bubble.y = handle.y - bubble.height / 2f + handle.height / 2f - bubble.translationX = (-45f).dpToPxEnd + if (bubbleEnabled) { + bubble.y = handle.y - bubble.height / 2f + handle.height / 2f + bubble.translationX = (-45f).dpToPxEnd + } } } diff --git a/app/src/main/res/layout/library_list_controller.xml b/app/src/main/res/layout/library_list_controller.xml index f54a647cc0..e926e7c88b 100644 --- a/app/src/main/res/layout/library_list_controller.xml +++ b/app/src/main/res/layout/library_list_controller.xml @@ -54,11 +54,8 @@ + android:layout_height="match_parent" + app:fastScrollerBubbleEnabled="true" /> + android:gravity="center" + app:layout_anchor="@id/category_hopper_frame" + app:layout_anchorGravity="start|center" + tools:text="Category and a long one" + tools:alpha="1" /> @@ -45,9 +45,9 @@ android:paddingTop="8dp" android:paddingEnd="0dp" android:paddingBottom="8dp" - app:layout_constrainedHeight="true" android:textColor="?android:attr/textColorPrimary" app:iconColor="?android:attr/textColorPrimary" + app:layout_constrainedHeight="true" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" app:layout_constraintTop_toTopOf="parent" @@ -55,17 +55,13 @@ + tools:text="Volume 12" + tools:alpha="1" /> diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index d05f74bbd4..6f3ddd7fea 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -172,6 +172,19 @@ @drawable/list_item_selector + +