list: fix incomplete scrolling in menu dialog

Fix an issue where the options in MenuDialog could not full scroll for
an unknown reason.

Derived from some absurd issue where BottomSheetBehavior dislikes
ConstraintLayout's spacing and decides to improperly allocate enough
space for the RecyclerView to scroll.
This commit is contained in:
Alexander Capehart 2023-07-12 20:01:33 -06:00
parent 18d9c0adf0
commit 124726693e
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 70 additions and 62 deletions

View file

@ -36,9 +36,6 @@ import org.oxycblt.auxio.util.unlikelyToBeNull
* A lifecycle-aware [DialogFragment] that automatically manages the [ViewBinding] lifecycle as a
* [BottomSheetDialogFragment].
*
* TODO: Debug why menu RecyclerView believes it can scroll more than it actually can in
* landscape.
*
* @author Alexander Capehart (OxygenCobalt)
*/
abstract class ViewBindingBottomSheetDialogFragment<VB : ViewBinding> :

View file

@ -1,11 +1,20 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<!--
Required to use a LinearLayout here for space allocation to stop the BottomSheetDialog
from flipping out and not allowing the RecyclerView to scroll fully.
-->
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/menu_handle"
android:layout_width="match_parent"
@ -16,8 +25,8 @@
<org.oxycblt.auxio.image.CoverView
android:id="@+id/menu_cover"
style="@style/Widget.Auxio.Image.Full"
android:layout_marginBottom="@dimen/spacing_medium"
android:layout_marginStart="@dimen/spacing_medium"
android:layout_marginBottom="@dimen/spacing_medium"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu_handle" />
@ -38,9 +47,9 @@
<TextView
android:id="@+id/menu_name"
style="@style/Widget.Auxio.TextView.Primary"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/Widget.Auxio.TextView.Primary"
app:layout_constraintBottom_toTopOf="@+id/menu_info"
app:layout_constraintEnd_toEndOf="@+id/menu_type"
app:layout_constraintStart_toStartOf="@+id/menu_type"
@ -49,31 +58,33 @@
<TextView
android:id="@+id/menu_info"
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
android:layout_width="0dp"
android:layout_height="wrap_content"
style="@style/Widget.Auxio.TextView.Secondary.Marquee"
android:layout_marginBottom="@dimen/spacing_small"
android:textColor="?android:attr/textColorSecondary"
app:layout_constraintBottom_toBottomOf="@+id/menu_cover"
app:layout_constraintEnd_toEndOf="@+id/menu_type"
app:layout_constraintStart_toStartOf="@+id/menu_name"
app:layout_constraintTop_toBottomOf="@+id/menu_name"
app:layout_constraintBottom_toBottomOf="@+id/menu_cover"
android:layout_marginBottom="@dimen/spacing_small"
tools:text="Info A" />
<com.google.android.material.divider.MaterialDivider
android:id="@+id/materialDivider"
android:id="@+id/menu_divider"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/spacing_medium"
app:layout_constraintTop_toBottomOf="@+id/menu_cover" />
</androidx.constraintlayout.widget.ConstraintLayout>
<org.oxycblt.auxio.list.recycler.AuxioRecyclerView
android:id="@+id/menu_option_recycler"
style="@style/Widget.Auxio.RecyclerView.Linear"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_height="match_parent"
android:overScrollMode="never"
app:layout_constraintTop_toBottomOf="@+id/materialDivider"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/menu_divider"
tools:listitem="@layout/item_menu_option" />
</androidx.constraintlayout.widget.ConstraintLayout>
</LinearLayout>