summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anton Potapov <apotapov@google.com> 2024-11-28 16:08:20 +0000
committer Anton Potapov <apotapov@google.com> 2024-12-17 08:25:37 -0800
commit1bcdc236b8a3eebfa03d8f09a8d229a44c498a04 (patch)
treee6b648e23121d675a14a5d2a309526c70c476651
parent043219057b135bc1791ced746dac9d60cbcc71c3 (diff)
Fix Material Slider day-night theme change in the Volume Dialog.
For some reason color picker doesn't resolve color attributes inside of it for the material slider. This works perfectly for the exact colors though. Given that the sliders in the Volume Dialog are always enabled, we can directly use the attributes. Flag: com.android.systemui.volume_redesign Bug: 369994956 Test: manual on the phone. Change current mode from dark to light and back. Change-Id: Iddb79cfe761ce2b64ffea9b4f3cde776a482e756
-rw-r--r--packages/SystemUI/res/color/slider_active_track_color.xml19
-rw-r--r--packages/SystemUI/res/color/slider_inactive_track_color.xml19
-rw-r--r--packages/SystemUI/res/color/slider_thumb_color.xml20
-rw-r--r--packages/SystemUI/res/layout/volume_dialog_slider.xml8
-rw-r--r--packages/SystemUI/res/values/styles.xml13
5 files changed, 9 insertions, 70 deletions
diff --git a/packages/SystemUI/res/color/slider_active_track_color.xml b/packages/SystemUI/res/color/slider_active_track_color.xml
deleted file mode 100644
index 8ba5e4901a7a..000000000000
--- a/packages/SystemUI/res/color/slider_active_track_color.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 2024 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" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="@androidprv:color/materialColorPrimary" android:state_enabled="true" />
- <item android:color="@androidprv:color/materialColorSurfaceContainerHighest" />
-</selector> \ No newline at end of file
diff --git a/packages/SystemUI/res/color/slider_inactive_track_color.xml b/packages/SystemUI/res/color/slider_inactive_track_color.xml
deleted file mode 100644
index 7980f804a516..000000000000
--- a/packages/SystemUI/res/color/slider_inactive_track_color.xml
+++ /dev/null
@@ -1,19 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 2024 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" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="@androidprv:color/materialColorSurfaceContainerHighest" android:state_enabled="true" />
- <item android:color="@androidprv:color/materialColorPrimary" />
-</selector> \ No newline at end of file
diff --git a/packages/SystemUI/res/color/slider_thumb_color.xml b/packages/SystemUI/res/color/slider_thumb_color.xml
deleted file mode 100644
index 8a98902426f8..000000000000
--- a/packages/SystemUI/res/color/slider_thumb_color.xml
+++ /dev/null
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?><!--
- ~ Copyright (C) 2024 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" xmlns:androidprv="http://schemas.android.com/apk/prv/res/android">
- <item android:color="@androidprv:color/materialColorSurfaceContainerHighest" android:state_enabled="false" />
- <item android:color="@androidprv:color/materialColorPrimary" />
-</selector>
diff --git a/packages/SystemUI/res/layout/volume_dialog_slider.xml b/packages/SystemUI/res/layout/volume_dialog_slider.xml
index 9ac456c17084..0acf4109bbb5 100644
--- a/packages/SystemUI/res/layout/volume_dialog_slider.xml
+++ b/packages/SystemUI/res/layout/volume_dialog_slider.xml
@@ -14,7 +14,6 @@
limitations under the License.
-->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
- xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
@@ -24,11 +23,6 @@
android:layout_width="@dimen/volume_dialog_slider_width"
android:layout_height="@dimen/volume_dialog_slider_height"
android:layout_gravity="center"
- android:theme="@style/Theme.Material3.Light"
android:orientation="vertical"
- app:thumbHeight="52dp"
- app:trackCornerSize="12dp"
- app:trackHeight="40dp"
- app:trackStopIndicatorSize="6dp"
- app:trackInsideCornerSize="2dp" />
+ android:theme="@style/Theme.Material3.DayNight" />
</FrameLayout> \ No newline at end of file
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index 3156a50df96f..f6c1ecea2886 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -559,15 +559,18 @@
<style name="SystemUI.Material3.Slider.Volume">
<item name="trackHeight">40dp</item>
<item name="thumbHeight">52dp</item>
+ <item name="trackCornerSize">12dp</item>
+ <item name="trackInsideCornerSize">2dp</item>
+ <item name="trackStopIndicatorSize">6dp</item>
</style>
<style name="SystemUI.Material3.Slider" parent="@style/Widget.Material3.Slider">
<item name="labelStyle">@style/Widget.Material3.Slider.Label</item>
- <item name="thumbColor">@color/slider_thumb_color</item>
- <item name="tickColorActive">@color/slider_inactive_track_color</item>
- <item name="tickColorInactive">@color/slider_active_track_color</item>
- <item name="trackColorActive">@color/slider_active_track_color</item>
- <item name="trackColorInactive">@color/slider_inactive_track_color</item>
+ <item name="thumbColor">@androidprv:color/materialColorPrimary</item>
+ <item name="tickColorActive">@androidprv:color/materialColorSurfaceContainerHighest</item>
+ <item name="tickColorInactive">@androidprv:color/materialColorPrimary</item>
+ <item name="trackColorActive">@androidprv:color/materialColorPrimary</item>
+ <item name="trackColorInactive">@androidprv:color/materialColorSurfaceContainerHighest</item>
</style>
<style name="Theme.SystemUI.DayNightDialog" parent="@android:style/Theme.DeviceDefault.Light.Dialog"/>