Adding fast scroll to extensions list

This commit is contained in:
Jay 2020-05-07 15:05:14 -04:00
parent 8c394a4a7b
commit aa8195c48f
2 changed files with 24 additions and 10 deletions

View File

@ -60,6 +60,7 @@ ExtensionAdapter.OnButtonClickListener,
ext_recycler.setHasFixedSize(true) ext_recycler.setHasFixedSize(true)
ext_recycler.addItemDecoration(ExtensionDividerItemDecoration(context)) ext_recycler.addItemDecoration(ExtensionDividerItemDecoration(context))
ext_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener) ext_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener)
adapter?.fastScroller = fast_scroller
this.controller = controller this.controller = controller
presenter.onCreate() presenter.onCreate()
updateExtTitle() updateExtTitle()
@ -68,8 +69,8 @@ ExtensionAdapter.OnButtonClickListener,
val array = context.obtainStyledAttributes(attrsArray) val array = context.obtainStyledAttributes(attrsArray)
val headerHeight = array.getDimensionPixelSize(0, 0) val headerHeight = array.getDimensionPixelSize(0, 0)
array.recycle() array.recycle()
ext_recycler.doOnApplyWindowInsets { _, windowInsets, _ -> ext_recycler_layout.doOnApplyWindowInsets { v, windowInsets, _ ->
ext_recycler.updateLayoutParams<LayoutParams> { v.updateLayoutParams<MarginLayoutParams> {
topMargin = windowInsets.systemWindowInsetTop + headerHeight - topMargin = windowInsets.systemWindowInsetTop + headerHeight -
(sheet_layout.height) (sheet_layout.height)
} }

View File

@ -16,9 +16,9 @@
android:id="@+id/sheet_layout" android:id="@+id/sheet_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/bottom_sheet_rounded_background" android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?attr/colorPrimaryVariant" android:backgroundTint="?attr/colorPrimaryVariant"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
@ -43,8 +43,8 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginBottom="10dp"
android:layout_marginTop="6dp" android:layout_marginTop="6dp"
android:layout_marginBottom="10dp"
android:ellipsize="end" android:ellipsize="end"
android:gravity="center" android:gravity="center"
android:maxLines="1" android:maxLines="1"
@ -54,6 +54,11 @@
tools:text="Extensions" /> tools:text="Extensions" />
</LinearLayout> </LinearLayout>
<FrameLayout
android:id="@+id/ext_recycler_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/ext_recycler" android:id="@+id/ext_recycler"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -61,4 +66,12 @@
android:background="?android:attr/colorBackground" android:background="?android:attr/colorBackground"
android:clipToPadding="false" android:clipToPadding="false"
tools:listitem="@layout/extension_card_header" /> tools:listitem="@layout/extension_card_header" />
<eu.kanade.tachiyomi.ui.library.MaterialFastScroll
android:id="@+id/fast_scroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:fastScrollerBubbleEnabled="false" />
</FrameLayout>
</eu.kanade.tachiyomi.ui.extension.ExtensionBottomSheet> </eu.kanade.tachiyomi.ui.extension.ExtensionBottomSheet>