Update slider style
Flag: com.android.systemui.volume_redesign
Test: manual on foldable
Bug: 369994956
Change-Id: I82f63d9f22828b4b8e9f0fb712304d0db83bc3bf
diff --git a/packages/SystemUI/res/color/slider_active_track_color.xml b/packages/SystemUI/res/color/slider_active_track_color.xml
new file mode 100644
index 0000000..a5aa58d
--- /dev/null
+++ b/packages/SystemUI/res/color/slider_active_track_color.xml
@@ -0,0 +1,19 @@
+<?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:attr/materialColorPrimary" android:state_enabled="true" />
+ <item android:color="?androidprv:attr/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
new file mode 100644
index 0000000..89aef77
--- /dev/null
+++ b/packages/SystemUI/res/color/slider_inactive_track_color.xml
@@ -0,0 +1,19 @@
+<?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:attr/materialColorSurfaceContainerHighest" android:state_enabled="true" />
+ <item android:color="?androidprv:attr/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
new file mode 100644
index 0000000..5206049
--- /dev/null
+++ b/packages/SystemUI/res/color/slider_thumb_color.xml
@@ -0,0 +1,20 @@
+<?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:attr/materialColorSurfaceContainerHighest" android:state_enabled="false" />
+ <item android:color="?androidprv:attr/materialColorPrimary" />
+</selector>
diff --git a/packages/SystemUI/res/layout/volume_dialog_slider.xml b/packages/SystemUI/res/layout/volume_dialog_slider.xml
index 8acdd39..c1852b1 100644
--- a/packages/SystemUI/res/layout/volume_dialog_slider.xml
+++ b/packages/SystemUI/res/layout/volume_dialog_slider.xml
@@ -18,10 +18,11 @@
android:layout_height="@dimen/volume_dialog_slider_height">
<com.google.android.material.slider.Slider
+ style="@style/SystemUI.Material3.Slider.Volume"
android:id="@+id/volume_dialog_slider"
android:layout_width="@dimen/volume_dialog_slider_height"
android:layout_height="match_parent"
android:layout_gravity="center"
android:rotation="270"
- android:theme="@style/Theme.MaterialComponents.DayNight" />
+ android:theme="@style/Theme.Material3.Light" />
</FrameLayout>
diff --git a/packages/SystemUI/res/values/styles.xml b/packages/SystemUI/res/values/styles.xml
index ab45b9f..7d071cd 100644
--- a/packages/SystemUI/res/values/styles.xml
+++ b/packages/SystemUI/res/values/styles.xml
@@ -557,6 +557,20 @@
<item name="android:showWhenLocked">true</item>
</style>
+ <style name="SystemUI.Material3.Slider.Volume">
+ <item name="trackHeight">40dp</item>
+ <item name="thumbHeight">52dp</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>
+ </style>
+
<style name="Theme.SystemUI.DayNightDialog" parent="@android:style/Theme.DeviceDefault.Light.Dialog"/>
<style name="Theme.SystemUI.Dialog" parent="@style/Theme.SystemUI.DayNightDialog">
diff --git a/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialog.kt b/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialog.kt
index 097a60f..4fc9a7c 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialog.kt
+++ b/packages/SystemUI/src/com/android/systemui/volume/dialog/VolumeDialog.kt
@@ -19,10 +19,8 @@
import android.app.Dialog
import android.content.Context
import android.os.Bundle
-import android.view.ContextThemeWrapper
import android.view.MotionEvent
import com.android.systemui.dagger.qualifiers.Application
-import com.android.systemui.res.R
import com.android.systemui.volume.Events
import com.android.systemui.volume.dialog.domain.interactor.VolumeDialogVisibilityInteractor
import com.android.systemui.volume.dialog.ui.binder.VolumeDialogViewBinder
@@ -34,7 +32,7 @@
@Application context: Context,
private val viewBinder: VolumeDialogViewBinder,
private val visibilityInteractor: VolumeDialogVisibilityInteractor,
-) : Dialog(ContextThemeWrapper(context, R.style.volume_dialog_theme)) {
+) : Dialog(context) {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)