summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Fabian Kozynski <kozynski@google.com> 2024-07-03 19:33:40 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-07-03 19:33:40 +0000
commitffb72af882c504ec97a819a0575999c135e204e7 (patch)
tree960a63ea0e8eea9872e4e7195f2ea08cee5cee2d
parent0cc6ccb5fc4a12086747c7d7d2758531fe003ad9 (diff)
parent2fa844b3db2902f4564fd73dd14a964e15bdde8f (diff)
Merge "Minor optimizations to BrightnessSlider" into main
-rw-r--r--packages/SystemUI/src/com/android/systemui/brightness/ui/compose/BrightnessSlider.kt8
1 files changed, 4 insertions, 4 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 f991d5b8405f..8270db1e89a8 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
@@ -16,7 +16,7 @@
package com.android.systemui.brightness.ui.compose
-import androidx.compose.animation.core.animateIntAsState
+import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.size
@@ -57,12 +57,12 @@ private fun BrightnessSlider(
) {
var value by remember(gammaValue) { mutableIntStateOf(gammaValue) }
val animatedValue by
- animateIntAsState(targetValue = value, label = "BrightnessSliderAnimatedValue")
+ animateFloatAsState(targetValue = value.toFloat(), label = "BrightnessSliderAnimatedValue")
val floatValueRange = valueRange.first.toFloat()..valueRange.last.toFloat()
- val isRestricted = restriction is PolicyRestriction.Restricted
+ val isRestricted = remember(restriction) { restriction is PolicyRestriction.Restricted }
PlatformSlider(
- value = animatedValue.toFloat(),
+ value = animatedValue,
valueRange = floatValueRange,
enabled = !isRestricted,
onValueChange = {