Added Collapsing appbar to library tabs with an option to switch back to simple appbar

This commit is contained in:
Prathamesh More 2022-01-15 15:07:11 +05:30
parent ffd251ab62
commit b2e1ab2128
12 changed files with 159 additions and 46 deletions

View file

@ -0,0 +1,29 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.appbar.CollapsingToolbarLayout 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:id="@+id/collapsingToolbarLayout"
style="?attr/collapsingToolbarLayoutLargeStyle"
android:layout_width="match_parent"
android:layout_height="?attr/collapsingToolbarLayoutLargeSize"
app:collapsedTitleTextAppearance="@style/TextViewHeadline6"
app:expandedTitleMarginBottom="24dp"
app:expandedTitleMarginEnd="24dp"
app:expandedTitleMarginStart="24dp"
app:expandedTitleTextAppearance="@style/TextViewHeadline4"
app:layout_scrollFlags="scroll|exitUntilCollapsed|snap|enterAlwaysCollapsed">
<com.google.android.material.appbar.MaterialToolbar
android:id="@+id/toolbar"
style="@style/Toolbar"
android:layout_height="?actionBarSize"
app:layout_collapseMode="pin"
app:navigationIcon="@drawable/ic_search"
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
tools:title="@string/songs" />
<FrameLayout
android:id="@+id/toolbar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"/>
</com.google.android.material.appbar.CollapsingToolbarLayout>

View file

@ -6,37 +6,12 @@
android:layout_height="match_parent"
android:fitsSystemWindows="true">
<com.google.android.material.appbar.AppBarLayout
<code.name.monkey.retromusic.views.TopAppBarLayout
android:id="@+id/appBarLayout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:fitsSystemWindows="true">
<FrameLayout
android:id="@+id/toolbar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:navigationIcon="@drawable/ic_search"
app:popupTheme="?attr/toolbarPopupTheme"
app:title="@null"
tools:ignore="UnusedAttribute">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/appNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="@style/TextViewHeadline6"
android:textStyle="bold" />
</androidx.appcompat.widget.Toolbar>
</FrameLayout>
</com.google.android.material.appbar.AppBarLayout>
style="?appBarLayoutStyle"
android:fitsSystemWindows="true" />
<code.name.monkey.retromusic.views.insets.InsetsRecyclerView
android:id="@+id/recycler_view"

View file

@ -0,0 +1,25 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/toolbar_container"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_scrollFlags="scroll|enterAlways">
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:navigationIcon="@drawable/ic_search"
app:popupTheme="?attr/toolbarPopupTheme"
app:title="@null">
<com.google.android.material.textview.MaterialTextView
android:id="@+id/appNameText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="@style/TextViewHeadline6"
android:textStyle="bold" />
</androidx.appcompat.widget.Toolbar>
</FrameLayout>

View file

@ -50,6 +50,16 @@
<item>@string/unlabeled</item>
</array>
<array name="pref_appbar_mode_titles">
<item>@string/collapsing</item>
<item>@string/simple</item>
</array>
<string-array name="pref_appbar_mode_values">
<item>0</item>
<item>1</item>
</string-array>
<string-array name="pref_general_theme_list_titles">
<item>@string/light_theme_name</item>
<item>@string/dark_theme_name</item>
@ -203,4 +213,5 @@
<item>ur</item>
<item>vi</item>
</string-array>
<string name="collapsing">Collapsing</string>
</resources>

View file

@ -532,4 +532,5 @@
<string name="you_will_be_forwarded_to_the_issue_tracker_website">You will be forwarded to the issue tracker website.</string>
<string name="your_account_data_is_only_used_for_authentication">Your account data is only used for authentication.</string>
<string name="new_music_mix">New Music Mix</string>
<string name="pref_title_appbar_mode">App bar mode</string>
</resources>

View file

@ -69,6 +69,16 @@
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_tab_text_mode" />
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
android:defaultValue="0"
android:entries="@array/pref_appbar_mode_titles"
android:entryValues="@array/pref_appbar_mode_values"
android:key="appbar_mode"
android:layout="@layout/list_item_view"
android:negativeButtonText="@null"
android:positiveButtonText="@null"
android:title="@string/pref_title_appbar_mode" />
</code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory>
<code.name.monkey.appthemehelper.common.prefs.supportv7.ATEPreferenceCategory