Adding fast scroll to d/l queue

Also fixed fast scroll bubbles with long titles
closes #270
This commit is contained in:
Jay 2020-05-07 17:45:04 -04:00
parent 40a0094ec0
commit e94e405b80
4 changed files with 37 additions and 14 deletions

View File

@ -29,4 +29,8 @@ class DownloadAdapter(controller: DownloadItemListener) : FlexibleAdapter<Downlo
super.onItemSwiped(position, direction)
downloadItemListener.onItemRemoved(position)
}
override fun onCreateBubbleText(position: Int): String {
return getItem(position)?.download?.manga?.title ?: ""
}
}

View File

@ -55,6 +55,7 @@ class DownloadBottomSheet @JvmOverloads constructor(
dl_recycler.adapter = adapter
adapter?.isHandleDragEnabled = true
adapter?.isSwipeEnabled = true
adapter?.fastScroller = fast_scroller
dl_recycler.setHasFixedSize(true)
dl_recycler.addItemDecoration(ExtensionDividerItemDecoration(context))
dl_recycler.setOnApplyWindowInsetsListener(RecyclerWindowInsetsListener)
@ -65,8 +66,8 @@ class DownloadBottomSheet @JvmOverloads constructor(
val array = context.obtainStyledAttributes(attrsArray)
val headerHeight = array.getDimensionPixelSize(0, 0)
array.recycle()
dl_recycler.doOnApplyWindowInsets { _, windowInsets, _ ->
dl_recycler.updateLayoutParams<MarginLayoutParams> {
recycler_layout.doOnApplyWindowInsets { v, windowInsets, _ ->
v.updateLayoutParams<MarginLayoutParams> {
topMargin = windowInsets.systemWindowInsetTop + headerHeight - sheet_layout.height
}
}

View File

@ -16,9 +16,9 @@
android:id="@+id/sheet_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:background="@drawable/bottom_sheet_rounded_background"
android:backgroundTint="?attr/colorPrimaryVariant"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
@ -44,9 +44,9 @@
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="10dp"
android:layout_marginTop="6dp"
android:layout_marginEnd="10dp"
android:layout_marginBottom="10dp"
android:layout_marginTop="6dp"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
@ -57,22 +57,29 @@
</LinearLayout>
<FrameLayout
android:background="?android:attr/colorBackground"
android:layout_width="match_parent"
android:layout_height="match_parent">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?android:attr/colorBackground">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/dl_recycler"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clipToPadding="false"
tools:listitem="@layout/download_item"/>
tools:listitem="@layout/download_item" />
<eu.kanade.tachiyomi.widget.EmptyView
android:id="@+id/empty_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:visibility="gone"/>
android:visibility="gone" />
<eu.kanade.tachiyomi.ui.library.MaterialFastScroll
android:id="@+id/fast_scroller"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:fastScrollerBubbleEnabled="true" />
</FrameLayout>
</eu.kanade.tachiyomi.ui.download.DownloadBottomSheet>

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="match_parent">
@ -11,8 +12,8 @@
android:layout_gravity="end"
android:background="@android:color/transparent"/>
<RelativeLayout
android:layout_width="wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="end">
@ -21,10 +22,17 @@
style="@style/FloatingTextView"
android:id="@+id/fast_scroller_bubble"
android:layout_gravity="end|center_vertical"
android:layout_toStartOf="@+id/fast_scroller_handle"
app:layout_constraintEnd_toStartOf="@+id/fast_scroller_handle"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
app:layout_constrainedWidth="true"
android:layout_marginStart="52dp"
app:layout_constraintStart_toStartOf="parent"
android:maxLines="5"
android:visibility="gone"
tools:text="A"
app:layout_constraintHorizontal_bias="1.0"
tools:text="sdfs fas d fsA"
tools:visibility="visible"/>
<!-- Padding is here to have better grab -->
@ -34,10 +42,13 @@
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:contentDescription="@null"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:paddingStart="6dp"
android:paddingEnd="4dp"
android:src="@drawable/thumb_drawable"/>
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</merge>