diff options
| author | 2024-03-21 11:10:04 +0000 | |
|---|---|---|
| committer | 2024-03-21 11:10:04 +0000 | |
| commit | afdca93e70f2c7fbfce162d3868acdcff3f407eb (patch) | |
| tree | 138be518e824f0b6ac94304e14441981c304efa3 | |
| parent | 8800a495ecdd604c34d18c049d7ea01f0a8d0e39 (diff) | |
| parent | 4d95be4ce649e5e399c376e0d9d994122062ef54 (diff) | |
Merge "Add color change animations to PlatformSlider." into main
| -rw-r--r-- | packages/SystemUI/compose/core/src/com/android/compose/PlatformSlider.kt | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/packages/SystemUI/compose/core/src/com/android/compose/PlatformSlider.kt b/packages/SystemUI/compose/core/src/com/android/compose/PlatformSlider.kt index 596a297a6dbe..4a89e31bcea8 100644 --- a/packages/SystemUI/compose/core/src/com/android/compose/PlatformSlider.kt +++ b/packages/SystemUI/compose/core/src/com/android/compose/PlatformSlider.kt @@ -18,6 +18,7 @@ package com.android.compose +import androidx.compose.animation.animateColorAsState import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateFloatAsState import androidx.compose.foundation.Canvas @@ -266,8 +267,17 @@ private fun TrackBackground( label = "PlatformSliderCornersAnimation", ) - val trackColor = colors.getTrackColor(enabled) - val indicatorColor = colors.getIndicatorColor(enabled) + val trackColor by + animateColorAsState( + colors.getTrackColor(enabled), + label = "PlatformSliderTrackColorAnimation", + ) + + val indicatorColor by + animateColorAsState( + colors.getIndicatorColor(enabled), + label = "PlatformSliderIndicatorColorAnimation", + ) Canvas(modifier.fillMaxSize()) { val trackCornerRadius = CornerRadius(size.height / 2, size.height / 2) val trackPath = Path() |