feat: App bar mode is also reflected in Home tab and Settings now (Compact / Expanded)
This commit is contained in:
parent
210d9afa1a
commit
bb99213848
10 changed files with 24 additions and 102 deletions
|
@ -45,7 +45,7 @@ android {
|
||||||
versionNameSuffix ' DEBUG'
|
versionNameSuffix ' DEBUG'
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
flavorDimensions "version"
|
flavorDimensions = ["version"]
|
||||||
productFlavors {
|
productFlavors {
|
||||||
normal {
|
normal {
|
||||||
dimension "version"
|
dimension "version"
|
||||||
|
|
|
@ -147,7 +147,9 @@ class FoldersFragment : AbsMainActivityFragment(R.layout.fragment_folder),
|
||||||
|
|
||||||
override fun onSaveInstanceState(outState: Bundle) {
|
override fun onSaveInstanceState(outState: Bundle) {
|
||||||
super.onSaveInstanceState(outState)
|
super.onSaveInstanceState(outState)
|
||||||
outState.putParcelable(CRUMBS, binding.breadCrumbs.stateWrapper)
|
if (_binding != null) {
|
||||||
|
outState.putParcelable(CRUMBS, binding.breadCrumbs.stateWrapper)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setUpTitle() {
|
private fun setUpTitle() {
|
||||||
|
|
|
@ -9,7 +9,7 @@ class HomeBinding(
|
||||||
val container = homeBinding.container
|
val container = homeBinding.container
|
||||||
val contentContainer = homeBinding.contentContainer
|
val contentContainer = homeBinding.contentContainer
|
||||||
val appBarLayout = homeBinding.appBarLayout
|
val appBarLayout = homeBinding.appBarLayout
|
||||||
val toolbar = homeBinding.toolbar
|
val toolbar = homeBinding.appBarLayout.toolbar
|
||||||
val bannerImage = homeBinding.imageLayout.bannerImage
|
val bannerImage = homeBinding.imageLayout.bannerImage
|
||||||
val userImage = homeBinding.imageLayout.userImage
|
val userImage = homeBinding.imageLayout.userImage
|
||||||
val lastAdded = homeBinding.homeContent.absPlaylists.lastAdded
|
val lastAdded = homeBinding.homeContent.absPlaylists.lastAdded
|
||||||
|
@ -18,6 +18,5 @@ class HomeBinding(
|
||||||
val history = homeBinding.homeContent.absPlaylists.history
|
val history = homeBinding.homeContent.absPlaylists.history
|
||||||
val recyclerView = homeBinding.homeContent.recyclerView
|
val recyclerView = homeBinding.homeContent.recyclerView
|
||||||
val titleWelcome = homeBinding.imageLayout.titleWelcome
|
val titleWelcome = homeBinding.imageLayout.titleWelcome
|
||||||
val appNameText = homeBinding.appNameText
|
|
||||||
val suggestions = homeBinding.homeContent.suggestions
|
val suggestions = homeBinding.homeContent.suggestions
|
||||||
}
|
}
|
|
@ -179,7 +179,7 @@ class HomeFragment :
|
||||||
}
|
}
|
||||||
val hexColor = String.format("#%06X", 0xFFFFFF and accentColor())
|
val hexColor = String.format("#%06X", 0xFFFFFF and accentColor())
|
||||||
val appName = "Retro <span style='color:$hexColor';>Music</span>".parseAsHtml()
|
val appName = "Retro <span style='color:$hexColor';>Music</span>".parseAsHtml()
|
||||||
binding.appNameText.text = appName
|
binding.appBarLayout.title = appName
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun loadProfile() {
|
private fun loadProfile() {
|
||||||
|
|
|
@ -17,6 +17,7 @@ package code.name.monkey.retromusic.fragments.settings
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
import code.name.monkey.appthemehelper.common.prefs.supportv7.ATEListPreference
|
||||||
|
import code.name.monkey.retromusic.APPBAR_MODE
|
||||||
import code.name.monkey.retromusic.HOME_ALBUM_GRID_STYLE
|
import code.name.monkey.retromusic.HOME_ALBUM_GRID_STYLE
|
||||||
import code.name.monkey.retromusic.HOME_ARTIST_GRID_STYLE
|
import code.name.monkey.retromusic.HOME_ARTIST_GRID_STYLE
|
||||||
import code.name.monkey.retromusic.R
|
import code.name.monkey.retromusic.R
|
||||||
|
@ -47,5 +48,10 @@ class PersonalizeSettingsFragment : AbsSettingsFragment() {
|
||||||
setSummary(prefs, newValue)
|
setSummary(prefs, newValue)
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
val appBarMode: ATEListPreference? = findPreference(APPBAR_MODE)
|
||||||
|
appBarMode?.setOnPreferenceChangeListener { _, _ ->
|
||||||
|
restartActivity()
|
||||||
|
true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -39,14 +39,11 @@ class SettingsFragment : Fragment(R.layout.fragment_settings), ColorCallback {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupToolbar() {
|
private fun setupToolbar() {
|
||||||
applyToolbar(binding.toolbar)
|
|
||||||
binding.toolbar.setNavigationOnClickListener {
|
|
||||||
requireActivity().onBackPressedDispatcher.onBackPressed()
|
|
||||||
}
|
|
||||||
val navController: NavController = findNavController(R.id.contentFrame)
|
val navController: NavController = findNavController(R.id.contentFrame)
|
||||||
|
binding.appBarLayout.toolbar.setNavigationIcon(R.drawable.ic_arrow_back)
|
||||||
navController.addOnDestinationChangedListener { _, _, _ ->
|
navController.addOnDestinationChangedListener { _, _, _ ->
|
||||||
binding.collapsingToolbarLayout.title =
|
binding.appBarLayout.title =
|
||||||
navController.currentDestination?.let { getStringFromDestination(it) }
|
navController.currentDestination?.let { getStringFromDestination(it) }.toString()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -59,7 +59,7 @@ class TopAppBarLayout @JvmOverloads constructor(
|
||||||
simpleAppbarBinding?.toolbar!!
|
simpleAppbarBinding?.toolbar!!
|
||||||
}
|
}
|
||||||
|
|
||||||
var title: String
|
var title: CharSequence
|
||||||
get() = if (mode == AppBarMode.COLLAPSING) {
|
get() = if (mode == AppBarMode.COLLAPSING) {
|
||||||
collapsingAppbarBinding?.collapsingToolbarLayout?.title.toString()
|
collapsingAppbarBinding?.collapsingToolbarLayout?.title.toString()
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -18,42 +18,12 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<code.name.monkey.retromusic.views.TopAppBarLayout
|
||||||
android:id="@+id/appBarLayout"
|
android:id="@+id/appBarLayout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true" />
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
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>
|
|
||||||
|
|
||||||
<ViewStub
|
|
||||||
android:id="@+id/cab_stub"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/toolbar_height" />
|
|
||||||
</FrameLayout>
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
|
|
|
@ -18,42 +18,13 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:fitsSystemWindows="true">
|
android:fitsSystemWindows="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<code.name.monkey.retromusic.views.TopAppBarLayout
|
||||||
android:id="@+id/appBarLayout"
|
android:id="@+id/appBarLayout"
|
||||||
|
style="?appBarLayoutStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
app:liftOnScroll="true">
|
android:theme="@style/CenteredCheckBoxTheme" />
|
||||||
|
|
||||||
<FrameLayout
|
|
||||||
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>
|
|
||||||
|
|
||||||
<ViewStub
|
|
||||||
android:id="@+id/cab_stub"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="@dimen/toolbar_height" />
|
|
||||||
</FrameLayout>
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
android:id="@+id/container"
|
android:id="@+id/container"
|
||||||
|
|
|
@ -16,34 +16,11 @@
|
||||||
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior"
|
||||||
app:navGraph="@navigation/settings_graph" />
|
app:navGraph="@navigation/settings_graph" />
|
||||||
|
|
||||||
<com.google.android.material.appbar.AppBarLayout
|
<code.name.monkey.retromusic.views.TopAppBarLayout
|
||||||
android:id="@+id/appBarLayout"
|
android:id="@+id/appBarLayout"
|
||||||
|
style="?appBarLayoutStyle"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:fitsSystemWindows="true"
|
android:fitsSystemWindows="true"
|
||||||
app:liftOnScroll="true">
|
android:theme="@style/CenteredCheckBoxTheme" />
|
||||||
|
|
||||||
<com.google.android.material.appbar.CollapsingToolbarLayout
|
|
||||||
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_width="match_parent"
|
|
||||||
android:layout_height="?actionBarSize"
|
|
||||||
app:layout_collapseMode="pin"
|
|
||||||
app:navigationIcon="@drawable/ic_arrow_back"
|
|
||||||
app:titleTextAppearance="@style/ToolbarTextAppearanceNormal"
|
|
||||||
tools:title="@string/action_settings" />
|
|
||||||
</com.google.android.material.appbar.CollapsingToolbarLayout>
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
|
||||||
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
</androidx.coordinatorlayout.widget.CoordinatorLayout>
|
Loading…
Add table
Add a link
Reference in a new issue