Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 4d95be4c authored by Anton Potapov's avatar Anton Potapov
Browse files

Add color change animations to PlatformSlider.

Flag: aconfig new_volume_panel TEAMFOOD
Test: manual on the phone with different screen and text scales
Test: atest PlatformSlidersScreenshotTest
Bug: 330477873
Change-Id: I984c98b0a102ee35ef34832c1e9876de92d9e6f9
parent ad87df88
Loading
Loading
Loading
Loading
+12 −2
Original line number Diff line number Diff line
@@ -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()