Use SideSheet instead of BottomSheet on landscape

This commit is contained in:
Koitharu
2023-05-30 20:27:38 +03:00
parent 3d05541f61
commit 0c132a521e
38 changed files with 700 additions and 177 deletions

View File

@@ -8,7 +8,7 @@
android:animateLayoutChanges="true"
android:orientation="vertical">
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -28,7 +28,6 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/margin_normal"
android:layout_marginTop="@dimen/margin_normal"
android:text="@string/list_mode"
android:textAppearance="?textAppearanceTitleSmall" />

View File

@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:orientation="horizontal"
android:paddingHorizontal="12dp"
android:paddingVertical="8dp"
app:layout_scrollFlags="scroll|exitUntilCollapsed">
<Button
android:id="@+id/button_create"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/create_category"
app:icon="@drawable/ic_add" />
<Button
android:id="@+id/button_manage"
style="@style/Widget.Material3.Button.OutlinedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:ellipsize="end"
android:singleLine="true"
android:text="@string/manage"
app:icon="@drawable/ic_edit" />
</LinearLayout>

View File

@@ -0,0 +1,52 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
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="wrap_content"
tools:orientation="vertical"
tools:parentTag="android.widget.LinearLayout">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/dragHandle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible" />
<LinearLayout
android:id="@+id/layout_sidesheet"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:baselineAligned="false"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingVertical="8dp"
android:visibility="gone"
tools:visibility="visible">
<TextView
android:id="@+id/textView_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_weight="1"
android:ellipsize="end"
android:singleLine="true"
android:textAppearance="?textAppearanceBodyLarge"
tools:text="@string/filter" />
<ImageView
android:id="@+id/button_close"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="8dp"
android:background="?selectableItemBackgroundBorderless"
android:padding="16dp"
app:srcCompat="?actionModeCloseDrawable"
app:tint="?colorControlActivated" />
</LinearLayout>
</merge>

View File

@@ -7,23 +7,10 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/button_done"
style="@style/Widget.Material3.Button.UnelevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginHorizontal="@dimen/toolbar_button_margin"
android:text="@string/done"
android:visibility="gone"
tools:visibility="visible" />
</org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar>
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"
@@ -31,6 +18,8 @@
android:layout_height="match_parent"
android:clipToPadding="false"
android:orientation="vertical"
android:scrollIndicators="top"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_checkable_new" />
</LinearLayout>

View File

@@ -7,7 +7,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -19,6 +19,7 @@
android:layout_height="match_parent"
android:layout_below="@id/headerBar"
android:orientation="vertical"
android:scrollIndicators="top"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
tools:listitem="@layout/item_chapter" />

View File

@@ -7,33 +7,24 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:menu="@menu/opt_categories_bs"
app:title="@string/add_to_favourites">
<Button
android:id="@+id/button_done"
style="@style/Widget.Material3.Button.UnelevatedButton"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="end"
android:layout_marginHorizontal="@dimen/toolbar_button_margin"
android:text="@string/done" />
</org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar>
app:layout_scrollFlags="noScroll"
app:title="@string/add_to_favourites" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_categories"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clipToPadding="false"
android:orientation="vertical"
android:overScrollMode="never"
android:paddingVertical="@dimen/list_spacing"
android:paddingBottom="@dimen/list_spacing"
android:scrollIndicators="top"
android:scrollbars="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:ignore="UnusedAttribute"
tools:listitem="@layout/item_checkable_new" />
</LinearLayout>

View File

@@ -7,7 +7,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
@@ -22,11 +22,13 @@
android:layout_height="wrap_content"
android:clipToPadding="false"
android:padding="@dimen/grid_spacing"
android:scrollIndicators="top"
app:bubbleSize="small"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="3"
app:trackColor="?attr/colorOutline"
tools:listitem="@layout/item_page_thumb" />
tools:listitem="@layout/item_page_thumb"
tools:targetApi="m" />
</FrameLayout>

View File

@@ -7,7 +7,7 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<org.koitharu.kotatsu.core.ui.widgets.BottomSheetHeaderBar
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@@ -15,7 +15,8 @@
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:scrollIndicators="top">
<LinearLayout
android:layout_width="match_parent"

View File

@@ -11,13 +11,14 @@
android:layout_height="wrap_content"
android:paddingBottom="16dp">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/dragHandle"
<org.koitharu.kotatsu.core.ui.sheet.AdaptiveSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:title="@string/tracking" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/imageView_cover"
@@ -30,7 +31,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/dragHandle"
app:layout_constraintTop_toBottomOf="@id/headerBar"
app:layout_constraintWidth_percent="0.3"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover"
tools:background="@tools:sample/backgrounds/scenic"
@@ -40,14 +41,14 @@
android:id="@+id/imageView_logo"
android:layout_width="32dp"
android:layout_height="32dp"
android:padding="4dp"
android:layout_margin="@dimen/card_indicator_offset"
android:background="@drawable/bg_badge_accent"
android:padding="4dp"
app:layout_constraintBottom_toBottomOf="@id/imageView_cover"
app:layout_constraintEnd_toEndOf="@id/imageView_cover"
app:tint="?attr/colorOnSecondary"
tools:ignore="ContentDescription"
tools:src="@drawable/ic_shikimori"
app:tint="?attr/colorOnSecondary" />
tools:src="@drawable/ic_shikimori" />
<TextView
android:id="@+id/textView_title"
@@ -60,7 +61,7 @@
android:textAppearance="?attr/textAppearanceHeadlineSmall"
app:layout_constraintEnd_toStartOf="@id/button_menu"
app:layout_constraintStart_toEndOf="@id/imageView_cover"
app:layout_constraintTop_toBottomOf="@id/dragHandle"
app:layout_constraintTop_toBottomOf="@id/headerBar"
tools:text="@tools:sample/lorem[9]" />
<ImageButton
@@ -72,7 +73,7 @@
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/open_in_browser"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/dragHandle"
app:layout_constraintTop_toBottomOf="@id/headerBar"
app:tint="?android:colorControlNormal" />
<RatingBar