style: remove elevation from toolbars
Remove the elevation component from all toolbars and the bottom bar. Material3 states that top and bottom app bars should not cast a drop shadow. Auxio ignored this and used one anyway. This largely stemmed from incorrect use of the AppBarLayout styles, which were mostly just incorrect M2 styles with a new background plastered over. Fix this by creating a new style that inherits the proper M3 styles and then using that on all AppBarLayout instances in the app.
This commit is contained in:
parent
04bec3161f
commit
f377e144dd
8 changed files with 13 additions and 23 deletions
|
@ -24,9 +24,8 @@ import org.oxycblt.auxio.R
|
||||||
import org.oxycblt.auxio.detail.DetailViewModel
|
import org.oxycblt.auxio.detail.DetailViewModel
|
||||||
import org.oxycblt.auxio.music.Song
|
import org.oxycblt.auxio.music.Song
|
||||||
import org.oxycblt.auxio.util.getAttrColorSafe
|
import org.oxycblt.auxio.util.getAttrColorSafe
|
||||||
import org.oxycblt.auxio.util.getDimenSafe
|
import org.oxycblt.auxio.util.getDimenSizeSafe
|
||||||
import org.oxycblt.auxio.util.getDrawableSafe
|
import org.oxycblt.auxio.util.getDrawableSafe
|
||||||
import org.oxycblt.auxio.util.pxOfDp
|
|
||||||
import org.oxycblt.auxio.util.replaceInsetsCompat
|
import org.oxycblt.auxio.util.replaceInsetsCompat
|
||||||
import org.oxycblt.auxio.util.stateList
|
import org.oxycblt.auxio.util.stateList
|
||||||
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
import org.oxycblt.auxio.util.systemBarInsetsCompat
|
||||||
|
@ -98,7 +97,6 @@ class PlaybackLayout @JvmOverloads constructor(
|
||||||
private var initMotionX = 0f
|
private var initMotionX = 0f
|
||||||
private var initMotionY = 0f
|
private var initMotionY = 0f
|
||||||
private val tRect = Rect()
|
private val tRect = Rect()
|
||||||
private val elevationNormal = context.getDimenSafe(R.dimen.elevation_normal)
|
|
||||||
|
|
||||||
/** See [isDragging] */
|
/** See [isDragging] */
|
||||||
private val dragStateField = ViewDragHelper::class.java.getDeclaredField("mDragState").apply {
|
private val dragStateField = ViewDragHelper::class.java.getDeclaredField("mDragState").apply {
|
||||||
|
@ -119,7 +117,7 @@ class PlaybackLayout @JvmOverloads constructor(
|
||||||
|
|
||||||
playbackContainerBg = MaterialShapeDrawable.createWithElevationOverlay(context).apply {
|
playbackContainerBg = MaterialShapeDrawable.createWithElevationOverlay(context).apply {
|
||||||
fillColor = context.getAttrColorSafe(R.attr.colorSurface).stateList
|
fillColor = context.getAttrColorSafe(R.attr.colorSurface).stateList
|
||||||
elevation = context.pxOfDp(elevationNormal).toFloat()
|
elevation = context.getDimenSizeSafe(R.dimen.elevation_normal).toFloat()
|
||||||
}
|
}
|
||||||
|
|
||||||
// The way we fade out the elevation overlay is not by actually reducing the elevation
|
// The way we fade out the elevation overlay is not by actually reducing the elevation
|
||||||
|
@ -537,7 +535,6 @@ class PlaybackLayout @JvmOverloads constructor(
|
||||||
// Slowly reduce the elevation of the container as we slide up, eventually resulting in a
|
// Slowly reduce the elevation of the container as we slide up, eventually resulting in a
|
||||||
// neutral color instead of an elevated one when fully expanded.
|
// neutral color instead of an elevated one when fully expanded.
|
||||||
playbackContainerBg.alpha = (outRatio * 255).toInt()
|
playbackContainerBg.alpha = (outRatio * 255).toInt()
|
||||||
playbackContainerView.translationZ = elevationNormal * outRatio
|
|
||||||
|
|
||||||
// Fade out our bar view as we slide up
|
// Fade out our bar view as we slide up
|
||||||
playbackBarView.apply {
|
playbackBarView.apply {
|
||||||
|
|
|
@ -12,9 +12,7 @@
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
||||||
android:id="@+id/about_appbar"
|
android:id="@+id/about_appbar"
|
||||||
android:layout_width="match_parent"
|
style="@style/Widget.Auxio.AppBarLayout"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
|
|
|
@ -15,9 +15,7 @@
|
||||||
|
|
||||||
<org.oxycblt.auxio.detail.DetailAppBarLayout
|
<org.oxycblt.auxio.detail.DetailAppBarLayout
|
||||||
android:id="@+id/detail_appbar"
|
android:id="@+id/detail_appbar"
|
||||||
android:layout_width="match_parent"
|
style="@style/Widget.Auxio.AppBarLayout"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
app:liftOnScroll="true"
|
app:liftOnScroll="true"
|
||||||
app:liftOnScrollTargetViewId="@id/detail_recycler">
|
app:liftOnScrollTargetViewId="@id/detail_recycler">
|
||||||
|
|
||||||
|
|
|
@ -11,9 +11,7 @@
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
||||||
android:id="@+id/home_appbar"
|
android:id="@+id/home_appbar"
|
||||||
android:layout_width="match_parent"
|
style="@style/Widget.Auxio.AppBarLayout"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true">
|
||||||
|
|
||||||
<com.google.android.material.appbar.MaterialToolbar
|
<com.google.android.material.appbar.MaterialToolbar
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
||||||
android:id="@+id/queue_appbar"
|
android:id="@+id/queue_appbar"
|
||||||
android:layout_width="match_parent"
|
style="@style/Widget.Auxio.AppBarLayout"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
app:liftOnScroll="true"
|
app:liftOnScroll="true"
|
||||||
app:liftOnScrollTargetViewId="@id/queue_recycler">
|
app:liftOnScrollTargetViewId="@id/queue_recycler">
|
||||||
|
|
||||||
|
|
|
@ -9,9 +9,7 @@
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
||||||
android:id="@+id/search_appbar"
|
android:id="@+id/search_appbar"
|
||||||
android:layout_width="match_parent"
|
style="@style/Widget.Auxio.AppBarLayout"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
app:liftOnScroll="true"
|
app:liftOnScroll="true"
|
||||||
app:liftOnScrollTargetViewId="@id/search_recycler">
|
app:liftOnScrollTargetViewId="@id/search_recycler">
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,7 @@
|
||||||
|
|
||||||
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
<org.oxycblt.auxio.ui.EdgeAppBarLayout
|
||||||
android:id="@+id/settings_appbar"
|
android:id="@+id/settings_appbar"
|
||||||
android:layout_width="match_parent"
|
style="@style/Widget.Auxio.AppBarLayout"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/colorSurface"
|
|
||||||
android:clickable="true"
|
android:clickable="true"
|
||||||
android:focusable="true"
|
android:focusable="true"
|
||||||
app:liftOnScroll="true">
|
app:liftOnScroll="true">
|
||||||
|
|
|
@ -2,6 +2,11 @@
|
||||||
<resources>
|
<resources>
|
||||||
<!-- SHARED RE-USABLE UI STYLES -->
|
<!-- SHARED RE-USABLE UI STYLES -->
|
||||||
|
|
||||||
|
<style name="Widget.Auxio.AppBarLayout" parent="Widget.Material3.AppBarLayout">
|
||||||
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
<item name="android:layout_height">wrap_content</item>
|
||||||
|
</style>
|
||||||
|
|
||||||
<!-- Base toolbar style -->
|
<!-- Base toolbar style -->
|
||||||
<style name="Widget.Auxio.Toolbar" parent="">
|
<style name="Widget.Auxio.Toolbar" parent="">
|
||||||
<item name="android:layout_width">match_parent</item>
|
<item name="android:layout_width">match_parent</item>
|
||||||
|
|
Loading…
Reference in a new issue