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

Commit a1885852 authored by Anton Potapov's avatar Anton Potapov
Browse files

Remove slider animation from the Volume Dialog

Slider steps animation will be fixed on the component side to match the
spec. This animation doesn't really fix anything now nor adds any value
without the Slider properly animating immediate steps

Flag: com.android.systemui.volume_redesign
Fixes: 395623147
Bug: 395578673
Test: manual on the phone. Adjust volume using physical buttons
Change-Id: I81334841561d32eb72eb02aff509a30584cfc383
parent 157826ef
Loading
Loading
Loading
Loading
+2 −18
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ package com.android.systemui.volume.dialog.sliders.ui
import android.graphics.drawable.Drawable
import android.view.View
import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.core.Animatable
import androidx.compose.animation.core.tween
import androidx.compose.animation.fadeIn
import androidx.compose.animation.fadeOut
@@ -61,11 +60,9 @@ import com.android.systemui.volume.haptics.ui.VolumeHapticsConfigsProvider
import javax.inject.Inject
import kotlin.math.round
import kotlin.math.roundToInt
import kotlinx.coroutines.Job
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.currentCoroutineContext
import kotlinx.coroutines.isActive
import kotlinx.coroutines.launch

@VolumeDialogSliderScope
class VolumeDialogSliderViewBinder
@@ -116,10 +113,6 @@ private fun VolumeDialogSlider(

    val steps = with(sliderStateModel.valueRange) { endInclusive - start - 1 }.toInt()

    var animateJob: Job? = null
    val animatedSliderValue =
        remember(sliderStateModel.value) { Animatable(sliderStateModel.value) }

    val interactionSource = remember { MutableInteractionSource() }
    val hapticsViewModel: SliderHapticsViewModel? =
        hapticsViewModelFactory?.let {
@@ -149,16 +142,7 @@ private fun VolumeDialogSlider(
                        hapticsViewModel?.onValueChangeEnded()
                    }
                    sliderState.onValueChange = { newValue ->
                        if (newValue != animatedSliderValue.targetValue) {
                            animateJob?.cancel()
                            animateJob =
                                coroutineScope.launch {
                                    animatedSliderValue.animateTo(newValue) {
                                        sliderState.value = value
                                    }
                                }
                        }

                        sliderState.value = newValue
                        hapticsViewModel?.addVelocityDataPoint(newValue)
                        overscrollViewModel.setSlider(
                            value = sliderState.value,
@@ -173,7 +157,7 @@ private fun VolumeDialogSlider(
    var lastDiscreteStep by remember { mutableFloatStateOf(round(sliderStateModel.value)) }
    LaunchedEffect(sliderStateModel.value) {
        val value = sliderStateModel.value
        launch { animatedSliderValue.animateTo(value) }
        sliderState.value = value
        if (value != lastDiscreteStep) {
            lastDiscreteStep = value
            hapticsViewModel?.onValueChange(value)