diff --git a/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScroller.kt b/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScroller.kt index eee187a85..9086f50db 100644 --- a/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScroller.kt +++ b/app/src/main/java/io/legado/app/ui/widget/recycler/scroller/FastScroller.kt @@ -103,9 +103,7 @@ class FastScroller : LinearLayout { @IdRes val recyclerViewId = mRecyclerView?.id ?: View.NO_ID val marginTop = resources.getDimensionPixelSize(R.dimen.fastscroll_scrollbar_margin_top) val marginBottom = resources.getDimensionPixelSize(R.dimen.fastscroll_scrollbar_margin_bottom) - if (recyclerViewId == View.NO_ID) { - throw IllegalArgumentException("RecyclerView must have a view ID") - } + require(recyclerViewId != View.NO_ID) { "RecyclerView must have a view ID" } when (viewGroup) { is ConstraintLayout -> { val constraintSet = ConstraintSet() diff --git a/app/src/main/res/layout/view_fastscroller.xml b/app/src/main/res/layout/view_fastscroller.xml index 7256c640f..d2c3b71d5 100644 --- a/app/src/main/res/layout/view_fastscroller.xml +++ b/app/src/main/res/layout/view_fastscroller.xml @@ -21,10 +21,6 @@ android:id="@+id/fastscroll_scrollbar" android:layout_width="wrap_content" android:layout_height="match_parent" - android:paddingEnd="@dimen/fastscroll_scrollbar_padding_end" - android:paddingLeft="@dimen/fastscroll_scrollbar_padding_start" - android:paddingRight="@dimen/fastscroll_scrollbar_padding_end" - android:paddingStart="@dimen/fastscroll_scrollbar_padding_start" android:visibility="gone" tools:visibility="visible"> @@ -41,6 +37,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_gravity="center_horizontal" + android:paddingEnd="@dimen/fastscroll_scrollbar_padding_end" + android:paddingStart="@dimen/fastscroll_scrollbar_padding_start" tools:ignore="ContentDescription" tools:src="@drawable/fastscroll_handle" />