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

Commit c5d32301 authored by Anton Potapov's avatar Anton Potapov Committed by Android (Google) Code Review
Browse files

Merge changes Ie880b995,I728c569c into main

* changes:
  Remove animation to prevent message from jumping
  Expand PlatformSlider label to fill width when it's disabled
parents 61977a66 0edebbed
Loading
Loading
Loading
Loading
+3 −1
Original line number Diff line number Diff line
@@ -241,6 +241,7 @@ private fun Track(
        measurePolicy =
            TrackMeasurePolicy(
                sliderState = sliderState,
                enabled = enabled,
                thumbSize = LocalDensity.current.run { thumbSize.roundToPx() },
                isRtl = isRtl,
                onDrawingStateMeasured = { drawingState = it }
@@ -304,6 +305,7 @@ private fun TrackBackground(
/** Measures track components sizes and calls [onDrawingStateMeasured] when it's done. */
private class TrackMeasurePolicy(
    private val sliderState: SliderState,
    private val enabled: Boolean,
    private val thumbSize: Int,
    private val isRtl: Boolean,
    private val onDrawingStateMeasured: (DrawingState) -> Unit,
@@ -334,7 +336,7 @@ private class TrackMeasurePolicy(
                )

        val iconSize = iconPlaceable?.width ?: 0
        val labelMaxWidth = (desiredWidth - iconSize) / 2
        val labelMaxWidth = if (enabled) (desiredWidth - iconSize) / 2 else desiredWidth - iconSize
        val labelPlaceable: Placeable? =
            measurables
                .fastFirstOrNull { it.layoutId == TrackComponent.Label }
+3 −11
Original line number Diff line number Diff line
@@ -16,11 +16,7 @@

package com.android.systemui.volume.panel.component.volume.ui.composable

import androidx.compose.animation.AnimatedVisibility
import androidx.compose.animation.animateContentSize
import androidx.compose.animation.core.animateFloatAsState
import androidx.compose.animation.slideInVertically
import androidx.compose.animation.slideOutVertically
import androidx.compose.foundation.basicMarquee
import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.size
@@ -107,7 +103,7 @@ fun VolumeSlider(
        },
        colors = sliderColors,
        label = {
            Column(modifier = Modifier.animateContentSize()) {
            Column(modifier = Modifier) {
                Text(
                    modifier = Modifier.basicMarquee(),
                    text = state.label,
@@ -116,12 +112,8 @@ fun VolumeSlider(
                    maxLines = 1,
                )

                if (!state.isEnabled) {
                    state.disabledMessage?.let { message ->
                    AnimatedVisibility(
                        !state.isEnabled,
                        enter = slideInVertically { it },
                        exit = slideOutVertically { it },
                    ) {
                        Text(
                            modifier = Modifier.basicMarquee(),
                            text = message,