ui: rework state layers
Unify the background state layers of the entire app by overriding colorControlHighlight. Lots of components still use it, so it's beneficial to make it consistent with the rest of the app theming.
This commit is contained in:
parent
6c59a03042
commit
ebdbd682b0
12 changed files with 46 additions and 47 deletions
14
app/src/main/res/color/sel_compat_ripple.xml
Normal file
14
app/src/main/res/color/sel_compat_ripple.xml
Normal file
|
@ -0,0 +1,14 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="@dimen/m3_ripple_selectable_pressed_alpha"
|
||||
android:color="?attr/colorOnSurfaceVariant"
|
||||
android:state_pressed="true"/>
|
||||
<item android:alpha="@dimen/m3_ripple_focused_alpha"
|
||||
android:color="?attr/colorOnSurfaceVariant"
|
||||
android:state_focused="true"/>
|
||||
<item android:alpha="@dimen/m3_ripple_hovered_alpha"
|
||||
android:color="?attr/colorOnSurfaceVariant"
|
||||
android:state_hovered="true"/>
|
||||
<item android:alpha="@dimen/m3_ripple_default_alpha"
|
||||
android:color="?attr/colorOnSurfaceVariant"/>
|
||||
</selector>
|
|
@ -1,21 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?><!--
|
||||
Copyright (C) 2021 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:alpha="0.12" android:color="?attr/colorOnSurfaceVariant" android:state_pressed="true" />
|
||||
<item android:alpha="0.2" android:color="?attr/colorOnSurfaceVariant" android:state_focused="true" />
|
||||
<item android:alpha="0.4" android:color="?attr/colorOnSurfaceVariant" android:state_hovered="true" />
|
||||
<item android:alpha="0.16" android:color="?attr/colorOnSurfaceVariant" />
|
||||
</selector>
|
|
@ -1,10 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:color="?attr/colorControlHighlight">
|
||||
<item android:id="@android:id/background">
|
||||
<shape android:shape="rectangle">
|
||||
<corners android:radius="@dimen/spacing_huge" />
|
||||
<solid android:color="?attr/colorPrimary" />
|
||||
</shape>
|
||||
</item>
|
||||
</ripple>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
||||
<style name="Theme.Auxio.V27" parent="Theme.Auxio">
|
||||
<style name="Theme.Auxio.V27" parent="Theme.Auxio.V23">
|
||||
<item name="android:navigationBarColor">@color/chrome_transparent_ish</item>
|
||||
<item name="android:statusBarColor">@color/chrome_transparent_ish</item>
|
||||
<item name="android:windowLightStatusBar">false</item>
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
Used on devices when we can technically use "transparent" system bars, but fully
|
||||
transparent system bars would actually be made translucent by the OS.
|
||||
-->
|
||||
<color name="chrome_transparent_ish">#01151515</color>
|
||||
<color name="chrome_transparent_ish">#01000000</color>
|
||||
|
||||
<!-- Replicate extra theme values for widgets -->
|
||||
<color name="widget_surface">@color/material_dynamic_secondary20</color>
|
||||
|
|
8
app/src/main/res/values-v23/styles_core.xml
Normal file
8
app/src/main/res/values-v23/styles_core.xml
Normal file
|
@ -0,0 +1,8 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<style name="Theme.Auxio.V23" parent="Theme.Auxio">
|
||||
|
||||
<!-- Fix dumb default android behavior -->
|
||||
<item name="colorControlHighlight">@color/sel_compat_ripple</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<style name="Theme.Auxio.V27" parent="Theme.Auxio">
|
||||
<style name="Theme.Auxio.V27" parent="Theme.Auxio.V23">
|
||||
<item name="android:navigationBarColor">@color/chrome_transparent_ish</item>
|
||||
<item name="android:statusBarColor">@color/chrome_transparent_ish</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
|
|
|
@ -9,5 +9,6 @@
|
|||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:enforceNavigationBarContrast">false</item>
|
||||
<item name="android:enforceStatusBarContrast">false</item>
|
||||
|
||||
</style>
|
||||
</resources>
|
|
@ -3,13 +3,13 @@
|
|||
<style name="Theme.Auxio.App" parent="Theme.Auxio.Base" />
|
||||
|
||||
<style name="Theme.Auxio.Widget" parent="@android:style/Theme.DeviceDefault.DayNight">
|
||||
<item name="colorSurface">@color/widget_surface</item>
|
||||
<item name="colorPrimary">?android:attr/colorAccent</item>
|
||||
<item name="colorOnPrimary">?attr/colorSurface</item>
|
||||
<item name="colorSecondary">?android:attr/colorAccent</item>
|
||||
<item name="colorControlNormal">?android:attr/colorControlNormal</item>
|
||||
<item name="colorControlHighlight">?android:attr/colorControlHighlight</item>
|
||||
|
||||
<item name="colorSurface">@color/widget_surface</item>
|
||||
<item name="colorSurfaceInverse">@color/widget_surface_inverse</item>
|
||||
<item name="colorOnSurfaceInverse">@color/widget_on_surface_inverse</item>
|
||||
|
||||
<item name="colorControlNormal">?android:attr/colorControlNormal</item>
|
||||
</style>
|
||||
</resources>
|
|
@ -7,7 +7,7 @@
|
|||
Used on devices when we can technically use "transparent" system bars, but fully
|
||||
transparent system bars would actually be made translucent by the OS.
|
||||
-->
|
||||
<color name="chrome_transparent_ish">#01fafafa</color>
|
||||
<color name="chrome_transparent_ish">#01ffffff</color>
|
||||
|
||||
<!-- Replicate extra theme values for widgets -->
|
||||
<color name="widget_surface">@color/material_dynamic_primary95</color>
|
||||
|
|
|
@ -2,8 +2,10 @@
|
|||
<resources>
|
||||
<!-- Master parent theme -->
|
||||
<style name="Theme.Auxio" parent="Theme.Material3.DynamicColors.DayNight" />
|
||||
<!-- Theme that implements nicer selector attributes not supported on lollipop-->
|
||||
<style name="Theme.Auxio.V23" parent="Theme.Auxio" />
|
||||
<!-- Template theme that handles edge-to-edge on other styles variants -->
|
||||
<style name="Theme.Auxio.V27" parent="Theme.Auxio">
|
||||
<style name="Theme.Auxio.V27" parent="Theme.Auxio.V23">
|
||||
<item name="android:statusBarColor">@color/chrome_translucent</item>
|
||||
<item name="android:navigationBarColor">@color/chrome_translucent</item>
|
||||
</style>
|
||||
|
@ -40,10 +42,16 @@
|
|||
<item name="textAppearanceBodyMedium">@style/TextAppearance.Auxio.BodyMedium</item>
|
||||
<item name="textAppearanceBodySmall">@style/TextAppearance.Auxio.BodySmall</item>
|
||||
|
||||
<!-- Work around hard-coded text highlight colors in the default Material3 theme -->
|
||||
<item name="android:textColorHighlight">@color/overlay_text_highlight</item>
|
||||
<item name="android:textColorHighlightInverse">@color/overlay_text_highlight_inverse</item>
|
||||
|
||||
<!-- Fix dumb default android behavior -->
|
||||
<item name="android:scrollbars">none</item>
|
||||
<item name="windowActionBar">false</item>
|
||||
<item name="windowNoTitle">true</item>
|
||||
|
||||
<item name="colorControlNormal">?attr/colorOnSurfaceVariant</item>
|
||||
<item name="colorControlActivated">?attr/colorPrimary</item>
|
||||
|
||||
<item name="preferenceStyle">@style/Preference.Auxio</item>
|
||||
|
@ -53,13 +61,8 @@
|
|||
</item>
|
||||
<item name="toolbarNavigationButtonStyle">@style/Widget.Auxio.Toolbar.Navigation</item>
|
||||
<item name="actionOverflowButtonStyle">@style/Widget.Auxio.Button.Overflow</item>
|
||||
|
||||
<!-- Work around hard-coded text highlight colors in the default Material3 theme -->
|
||||
<item name="android:textColorHighlight">@color/overlay_text_highlight</item>
|
||||
<item name="android:textColorHighlightInverse">@color/overlay_text_highlight_inverse</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Theme.Auxio.App" parent="@style/Theme.Auxio.Blue" />
|
||||
|
||||
<!--
|
||||
|
|
|
@ -172,8 +172,12 @@
|
|||
<style name="Widget.Auxio.Button.Secondary" parent="Widget.Material3.Button.OutlinedButton" />
|
||||
|
||||
<style name="Widget.Auxio.Button.Icon.Base" parent="Widget.Material3.Button.IconButton">
|
||||
<item name="iconTint">?attr/colorControlNormal</item>
|
||||
<item name="rippleColor">@color/sel_icon_button_ripple</item>
|
||||
<item name="materialThemeOverlay">@style/ThemeOverlay.Auxio.UncheckableIconButton</item>
|
||||
</style>
|
||||
|
||||
<style name="ThemeOverlay.Auxio.UncheckableIconButton" parent="">
|
||||
<item name="colorContainer">@android:color/transparent</item>
|
||||
<item name="colorOnContainer">?attr/colorOnSurfaceVariant</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.Auxio.Button.Icon.Small" parent="Widget.Auxio.Button.Icon.Base">
|
||||
|
|
Loading…
Reference in a new issue