Bottom sheet header bar view

This commit is contained in:
Koitharu
2022-07-24 18:36:35 +03:00
parent 802448cb5a
commit 36634414bc
21 changed files with 321 additions and 302 deletions

View File

@@ -0,0 +1,24 @@
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/dragHandle"
android:layout_width="match_parent"
android:layout_height="15dp"
android:minHeight="0dp"
android:paddingTop="12dp"
android:paddingBottom="0dp" />
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:theme="@style/ThemeOverlay.Kotatsu.MainToolbar"
tools:navigationIcon="?actionModeCloseDrawable"
tools:title="@string/options" />
</merge>

View File

@@ -7,42 +7,23 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:tint="?attr/colorOnSurfaceVariant"/>
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
<org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/sheet_toolbar_background">
android:layout_height="wrap_content">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navigationIcon="?actionModeCloseDrawable"
tools:title="@string/app_name">
<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" />
<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" />
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
</org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@@ -7,43 +7,17 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/toolbar_layout"
<org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:tint="?attr/colorOnSurfaceVariant" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/sheet_toolbar_background">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navigationIcon="?actionModeCloseDrawable"
app:title="@string/chapters" />
</com.google.android.material.appbar.AppBarLayout>
</LinearLayout>
app:title="@string/chapters" />
<org.koitharu.kotatsu.base.ui.list.fastscroll.FastScrollRecyclerView
android:id="@+id/recyclerView"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@id/toolbar_layout"
android:layout_below="@id/headerBar"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"

View File

@@ -8,22 +8,12 @@
android:orientation="vertical"
android:paddingBottom="@dimen/list_spacing">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:tint="?attr/colorOnSurfaceVariant"/>
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
<org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:layout_height="wrap_content"
app:menu="@menu/opt_categories_bs"
app:title="@string/add_to_favourites"
android:background="@drawable/sheet_toolbar_background">
app:title="@string/add_to_favourites">
<Button
android:id="@+id/button_done"
@@ -34,7 +24,7 @@
android:layout_marginHorizontal="@dimen/toolbar_button_margin"
android:text="@string/done" />
</com.google.android.material.appbar.MaterialToolbar>
</org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView_categories"

View File

@@ -7,29 +7,11 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:tint="?attr/colorOnSurfaceVariant" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
<org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/sheet_toolbar_background">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navigationIcon="?actionModeCloseDrawable"
app:title="@string/filter" />
</com.google.android.material.appbar.AppBarLayout>
android:layout_height="wrap_content"
app:title="@string/filter" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@@ -7,28 +7,10 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:tint="?attr/colorOnSurfaceVariant" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
<org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/sheet_toolbar_background">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navigationIcon="?actionModeCloseDrawable" />
</com.google.android.material.appbar.AppBarLayout>
android:layout_height="wrap_content" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@@ -7,29 +7,11 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:tint="?attr/colorOnSurfaceVariant" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
<org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/sheet_toolbar_background">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navigationIcon="?actionModeCloseDrawable"
app:title="@string/options" />
</com.google.android.material.appbar.AppBarLayout>
android:layout_height="wrap_content"
app:title="@string/options" />
<androidx.core.widget.NestedScrollView
android:layout_width="match_parent"

View File

@@ -10,33 +10,26 @@
android:layout_width="match_parent"
android:layout_height="wrap_content">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:layout_constraintBottom_toTopOf="@+id/textView_title"
<com.google.android.material.bottomsheet.BottomSheetDragHandleView
android:id="@+id/dragHandle"
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:tint="?attr/colorOnSurfaceVariant" />
app:layout_constraintTop_toTopOf="parent" />
<com.google.android.material.imageview.ShapeableImageView
android:id="@+id/imageView_cover"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_marginStart="16dp"
android:layout_marginTop="28dp"
android:foreground="?selectableItemBackground"
android:scaleType="centerCrop"
app:layout_constraintDimensionRatio="H,13:18"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="0"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@id/dragHandle"
app:layout_constraintWidth_percent="0.3"
app:shapeAppearanceOverlay="@style/ShapeAppearanceOverlay.Kotatsu.Cover"
tools:background="@tools:sample/backgrounds/scenic"
@@ -47,14 +40,13 @@
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginTop="28dp"
android:layout_marginEnd="6dp"
android:ellipsize="end"
android:maxLines="2"
android:textAppearance="?attr/textAppearanceHeadlineSmall"
app:layout_constraintEnd_toStartOf="@id/button_menu"
app:layout_constraintStart_toEndOf="@id/imageView_cover"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@id/dragHandle"
tools:text="@tools:sample/lorem[15]" />
<ImageButton
@@ -62,12 +54,11 @@
style="?android:attr/actionOverflowButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="8dp"
android:background="?selectableItemBackgroundBorderless"
android:contentDescription="@string/open_in_browser"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@id/dragHandle"
app:tint="?android:colorControlNormal" />
<RatingBar

View File

@@ -7,45 +7,22 @@
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="36dp"
android:layout_height="3dp"
android:layout_gravity="center"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:alpha="0.2"
android:src="@drawable/tab_rounded_rectangle"
app:layout_constraintBottom_toTopOf="@+id/textView_title"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:tint="?attr/colorOnSurfaceVariant" />
<com.google.android.material.appbar.AppBarLayout
android:id="@+id/appbar"
<org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar
android:id="@+id/headerBar"
android:layout_width="match_parent"
android:layout_height="?attr/actionBarSize"
android:background="@drawable/sheet_toolbar_background">
android:layout_height="wrap_content"
app:title="@string/tracking">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:navigationIcon="?actionModeCloseDrawable"
app:title="@string/tracking">
<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" />
<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_marginEnd="4dp"
android:text="@string/done" />
</com.google.android.material.appbar.MaterialToolbar>
</com.google.android.material.appbar.AppBarLayout>
</org.koitharu.kotatsu.base.ui.widgets.BottomSheetHeaderBar>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recyclerView"

View File

@@ -69,4 +69,9 @@
</attr>
</declare-styleable>
</resources>
<declare-styleable name="BottomSheetHeaderBar">
<attr name="title" />
<attr name="menu" />
</declare-styleable>
</resources>

View File

@@ -1,7 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<integer name="config_defaultAnimTime">300</integer>
<integer name="config_tinyAnimTime">50</integer>
<integer name="manga_badge_max_character_count">3</integer>
<integer name="explore_buttons_columns">2</integer>
</resources>
</resources>