ui: update material components

Update MDC to the alpha version in order to use some extra features.

I was planning to switch to the new MaterialSwitch, but alpha03 has
this insane crippling issue with ripples that blocks such. Use alpha02
and prep the app for the addition of the switch.
This commit is contained in:
OxygenCobalt
2022-07-18 10:06:26 -06:00
parent 10362b9efc
commit 276f067152
14 changed files with 105 additions and 85 deletions
@@ -0,0 +1,21 @@
<?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>
+5 -5
View File
@@ -2,10 +2,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M8,19V5L19,12Z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M8,19V5L19,12Z" />
</vector>
@@ -2,10 +2,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16.5,18V6H18.5V18ZM5.5,18V6L14.5,12Z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M16.5,18V6H18.5V18ZM5.5,18V6L14.5,12Z" />
</vector>
@@ -2,10 +2,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="?attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M5.5,18V6H7.5V18ZM18.5,18 L9.5,12 18.5,6Z"/>
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M5.5,18V6H7.5V18ZM18.5,18 L9.5,12 18.5,6Z" />
</vector>
@@ -0,0 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.switchmaterial.SwitchMaterial xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/switchWidget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:thumb="@drawable/ui_m3_switch_thumb"
app:thumbTint="@color/sel_m3_switch_thumb"
app:track="@drawable/ui_m3_switch_track"
app:trackTint="@color/sel_m3_switch_track" />
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Auxio.V27" parent="Theme.Auxio">
<item name="android:navigationBarColor">@color/chrome_transparent_ish</item>
<item name="android:statusBarColor">@color/chrome_transparent_ish</item>
@@ -39,6 +39,27 @@
<item name="android:scrollIndicators" tools:ignore="NewApi">top|bottom</item>
</style>
<style name="Preference.Auxio" parent="Preference.Material">
<item name="allowDividerBelow">false</item>
<item name="iconSpaceReserved">false</item>
</style>
<style name="Preference.Auxio.DialogPreference" parent="Preference.DialogPreference.Material">
<item name="allowDividerBelow">false</item>
<item name="iconSpaceReserved">false</item>
</style>
<style name="Preference.Auxio.PreferenceCategory" parent="Preference.Category.Material">
<item name="layout">@layout/item_header</item>
<item name="allowDividerBelow">false</item>
<item name="iconSpaceReserved">false</item>
</style>
<style name="Preference.Auxio.SwitchPreferenceCompat" parent="Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/view_preference_switch</item>
<item name="allowDividerBelow">false</item>
<item name="iconSpaceReserved">false</item>
</style>
<!-- Widget TextView that mimics the main Auxio Primary/Secondary TextViews. -->
<style name="Widget.Auxio.TextView.AppWidget" parent="Widget.Auxio.TextView.Base">
+10 -2
View File
@@ -7,6 +7,7 @@
<item name="android:statusBarColor">@color/chrome_translucent</item>
<item name="android:navigationBarColor">@color/chrome_translucent</item>
</style>
<style name="Theme.Auxio.V29" parent="Theme.Auxio.V27" />
<!-- Base theme -->
@@ -17,8 +18,6 @@
<item name="materialAlertDialogTheme">@style/Theme.Auxio.Dialog</item>
<item name="sliderStyle">@style/Widget.Auxio.Slider</item>
<item name="linearProgressIndicatorStyle">@style/Widget.Auxio.LinearProgressIndicator</item>
<item name="toolbarNavigationButtonStyle">@style/Widget.Auxio.Toolbar.Navigation</item>
<item name="actionOverflowButtonStyle">@style/Widget.Auxio.Button.Overflow</item>
<item name="textAppearanceDisplayLarge">@style/TextAppearance.Auxio.DisplayLarge</item>
<item name="textAppearanceDisplayMedium">@style/TextAppearance.Auxio.DisplayMedium</item>
@@ -47,11 +46,20 @@
<item name="windowNoTitle">true</item>
<item name="colorControlActivated">?attr/colorPrimary</item>
<item name="preferenceStyle">@style/Preference.Auxio</item>
<item name="preferenceCategoryStyle">@style/Preference.Auxio.PreferenceCategory</item>
<item name="dialogPreferenceStyle">@style/Preference.Auxio.DialogPreference</item>
<item name="switchPreferenceCompatStyle">@style/Preference.Auxio.SwitchPreferenceCompat
</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" />
<!--
+3 -5
View File
@@ -171,10 +171,9 @@
<style name="Widget.Auxio.Button.Secondary" parent="Widget.Material3.Button.OutlinedButton" />
<style name="Widget.Auxio.Button.Icon.Base" parent="Widget.Material3.Button.TextButton">
<item name="iconPadding">0dp</item>
<style name="Widget.Auxio.Button.Icon.Base" parent="Widget.Material3.Button.IconButton">
<item name="iconTint">?attr/colorControlNormal</item>
<item name="rippleColor">?attr/colorControlHighlight</item>
<item name="rippleColor">@color/sel_icon_button_ripple</item>
</style>
<style name="Widget.Auxio.Button.Icon.Small" parent="Widget.Auxio.Button.Icon.Base">
@@ -205,11 +204,10 @@
<item name="android:paddingBottom">@dimen/spacing_small</item>
</style>
<style name="Widget.Auxio.Button.PlayPause" parent="Widget.Material3.Button.TonalButton">
<style name="Widget.Auxio.Button.PlayPause" parent="Widget.Material3.Button.IconButton.Filled.Tonal">
<item name="android:minWidth">@dimen/size_play_pause_button</item>
<item name="android:minHeight">@dimen/size_play_pause_button</item>
<item name="iconSize">@dimen/size_icon_large</item>
<item name="iconPadding">0dp</item>
<item name="android:insetTop">0dp</item>
<item name="android:insetBottom">0dp</item>
<item name="android:insetLeft">0dp</item>
+1
View File
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<style name="Theme.Auxio.Black" parent="Theme.Auxio.Base">
<item name="colorSurface">@android:color/black</item>
</style>
+16 -56
View File
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
<PreferenceCategory
app:layout="@layout/item_header"
app:title="@string/set_ui">
<PreferenceCategory app:title="@string/set_ui">
<org.oxycblt.auxio.settings.ui.IntListPreference
app:defaultValue="@integer/theme_auto"
@@ -10,7 +8,6 @@
app:entryIcons="@array/icons_theme"
app:entryValues="@array/values_theme"
app:icon="@drawable/ic_light_24"
app:iconSpaceReserved="false"
app:isPreferenceVisible="@bool/enable_theme_settings"
app:key="@string/set_key_theme"
app:title="@string/set_theme" />
@@ -20,52 +17,42 @@
app:key="@string/set_key_accent"
app:title="@string/set_accent" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
app:allowDividerBelow="false"
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/set_key_black_theme"
app:summary="@string/set_black_mode_desc"
app:title="@string/set_black_mode" />
</PreferenceCategory>
<PreferenceCategory
app:layout="@layout/item_header"
app:title="@string/set_display">
<PreferenceCategory app:title="@string/set_display">
<org.oxycblt.auxio.settings.ui.WrappedDialogPreference
app:iconSpaceReserved="false"
app:key="@string/set_key_lib_tabs"
app:summary="@string/set_lib_tabs_desc"
app:title="@string/set_lib_tabs" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="@string/set_key_show_covers"
app:summary="@string/set_show_covers_desc"
app:title="@string/set_show_covers" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
<SwitchPreferenceCompat
app:defaultValue="false"
app:dependency="@string/set_key_show_covers"
app:iconSpaceReserved="false"
app:key="@string/set_key_quality_covers"
app:summary="@string/set_quality_covers_desc"
app:title="@string/set_quality_covers" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/set_key_round_mode"
app:summary="@string/set_round_mode_desc"
app:title="@string/set_round_mode" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
app:allowDividerBelow="false"
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/set_key_alt_notif_action"
app:summaryOff="@string/set_alt_repeat"
app:summaryOn="@string/set_alt_shuffle"
@@ -73,46 +60,35 @@
</PreferenceCategory>
<PreferenceCategory
app:layout="@layout/item_header"
app:title="@string/set_audio">
<PreferenceCategory app:title="@string/set_audio">
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
app:defaultValue="false"
app:iconSpaceReserved="false"
<SwitchPreferenceCompat
app:key="@string/set_key_headset_autoplay"
app:summary="@string/set_headset_autoplay_desc"
app:title="@string/set_headset_autoplay" />
<org.oxycblt.auxio.settings.ui.IntListPreference
app:allowDividerBelow="false"
app:defaultValue="@integer/replay_gain_off"
app:entries="@array/entries_replay_gain"
app:entryValues="@array/values_replay_gain"
app:iconSpaceReserved="false"
app:key="@string/set_key_replay_gain"
app:offValue="@integer/replay_gain_off"
app:title="@string/set_replay_gain" />
<org.oxycblt.auxio.settings.ui.WrappedDialogPreference
app:allowDividerBelow="false"
app:dependency="@string/set_key_replay_gain"
app:iconSpaceReserved="false"
app:key="@string/set_key_pre_amp"
app:summary="@string/set_pre_amp_desc"
app:title="@string/set_pre_amp" />
</PreferenceCategory>
<PreferenceCategory
app:layout="@layout/item_header"
app:title="@string/set_behavior">
<PreferenceCategory app:title="@string/set_behavior">
<org.oxycblt.auxio.settings.ui.IntListPreference
app:defaultValue="@integer/play_mode_songs"
app:entries="@array/entries_library_song_playback_mode"
app:entryValues="@array/values_library_song_playback_mode"
app:iconSpaceReserved="false"
app:key="@string/set_key_library_song_playback_mode"
app:title="@string/set_library_song_playback_mode"
app:useSimpleSummaryProvider="true" />
@@ -121,76 +97,60 @@
app:defaultValue="@integer/play_mode_none"
app:entries="@array/entries_detail_song_playback_mode"
app:entryValues="@array/values_detail_song_playback_mode"
app:iconSpaceReserved="false"
app:key="@string/set_key_detail_song_playback_mode"
app:title="@string/set_detail_song_playback_mode"
app:useSimpleSummaryProvider="true" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="@string/set_key_keep_shuffle"
app:summary="@string/set_keep_shuffle_desc"
app:title="@string/set_keep_shuffle" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
app:allowDividerBelow="false"
<SwitchPreferenceCompat
app:defaultValue="true"
app:iconSpaceReserved="false"
app:key="@string/set_key_rewind_prev"
app:summary="@string/set_rewind_prev_desc"
app:title="@string/set_rewind_prev" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
app:allowDividerBelow="false"
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/set_key_repeat_pause"
app:summary="@string/set_repeat_pause_desc"
app:title="@string/set_repeat_pause" />
</PreferenceCategory>
<PreferenceCategory
app:layout="@layout/item_header"
app:title="@string/set_content">
<PreferenceCategory app:title="@string/set_content">
<Preference
app:iconSpaceReserved="false"
app:key="@string/set_key_save_state"
app:summary="@string/set_save_desc"
app:title="@string/set_save" />
<Preference
app:iconSpaceReserved="false"
app:key="@string/set_key_restore_state"
app:summary="@string/set_restore_desc"
app:title="@string/set_restore" />
<Preference
app:iconSpaceReserved="false"
app:key="@string/set_key_reindex"
app:summary="@string/set_reindex_desc"
app:title="@string/set_reindex" />
<org.oxycblt.auxio.settings.ui.WrappedDialogPreference
app:iconSpaceReserved="false"
app:key="@string/set_key_music_dirs"
app:summary="@string/set_dirs_desc"
app:title="@string/set_dirs" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
app:allowDividerBelow="false"
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/set_key_quality_tags"
app:summary="@string/set_quality_tags_desc"
app:title="@string/set_quality_tags" />
<org.oxycblt.auxio.settings.ui.M3SwitchPreference
app:allowDividerBelow="false"
<SwitchPreferenceCompat
app:defaultValue="false"
app:iconSpaceReserved="false"
app:key="@string/set_key_observing"
app:summary="@string/set_observing_desc"
app:title="@string/set_observing" />