summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fabián Kozynski <kozynski@google.com> 2025-03-19 16:06:49 -0400
committer Fabián Kozynski <kozynski@google.com> 2025-03-20 09:30:05 -0400
commit3f51c4827fbf19e0fd9550308c66a53fc85689ef (patch)
treea26dea7e33f90b572f8b2635beccbec39f634620
parentd04635b1ca19d682bafe6fda98cf3e2923be194b (diff)
Fix brightness slider colors
Test: manual Fixes: 404874687 Flag: com.android.systemui.qs_ui_refactor_compose_fragment Change-Id: I368afe40d2bf7944ecdd0a0cea81c5a6ddb8bb63
-rw-r--r--packages/SystemUI/src/com/android/systemui/brightness/ui/compose/BrightnessSlider.kt16
1 files changed, 15 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/brightness/ui/compose/BrightnessSlider.kt b/packages/SystemUI/src/com/android/systemui/brightness/ui/compose/BrightnessSlider.kt
index 6aeb35b3b158..99f299918969 100644
--- a/packages/SystemUI/src/com/android/systemui/brightness/ui/compose/BrightnessSlider.kt
+++ b/packages/SystemUI/src/com/android/systemui/brightness/ui/compose/BrightnessSlider.kt
@@ -37,6 +37,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api
import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi
import androidx.compose.material3.MaterialTheme
import androidx.compose.material3.Slider
+import androidx.compose.material3.SliderColors
import androidx.compose.material3.SliderDefaults
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
@@ -73,6 +74,7 @@ import androidx.compose.ui.unit.dp
import androidx.lifecycle.compose.collectAsStateWithLifecycle
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.modifiers.padding
+import com.android.compose.theme.LocalAndroidColorScheme
import com.android.compose.ui.graphics.drawInOverlay
import com.android.systemui.Flags
import com.android.systemui.biometrics.Utils.toBitmap
@@ -139,7 +141,7 @@ fun BrightnessSlider(
} else {
null
}
- val colors = SliderDefaults.colors()
+ val colors = colors()
// The value state is recreated every time gammaValue changes, so we recreate this derivedState
// We have to use value as that's the value that changes when the user is dragging (gammaValue
@@ -211,6 +213,7 @@ fun BrightnessSlider(
interactionSource = interactionSource,
enabled = enabled,
thumbSize = DpSize(4.dp, 52.dp),
+ colors = colors,
)
},
track = { sliderState ->
@@ -293,6 +296,7 @@ fun BrightnessSlider(
trackInsideCornerSize = 2.dp,
drawStopIndicator = null,
thumbTrackGapSize = ThumbTrackGapSize,
+ colors = colors,
)
},
)
@@ -441,3 +445,13 @@ object BrightnessSliderMotionTestKeys {
val ActiveIconAlpha = MotionTestValueKey<Float>("activeIconAlpha")
val InactiveIconAlpha = MotionTestValueKey<Float>("inactiveIconAlpha")
}
+
+@Composable
+private fun colors(): SliderColors {
+ return SliderDefaults.colors()
+ .copy(
+ inactiveTrackColor = LocalAndroidColorScheme.current.surfaceEffect2,
+ activeTickColor = MaterialTheme.colorScheme.onPrimary,
+ inactiveTickColor = MaterialTheme.colorScheme.onSurface,
+ )
+}