diff options
author | 2024-03-21 17:44:34 +0000 | |
---|---|---|
committer | 2024-03-21 17:44:34 +0000 | |
commit | 7c975ff02540888c699eb24782eb874b692ceca6 (patch) | |
tree | 62d99fea7b01513ed005c4d7d093dcd64705f6c2 | |
parent | f58571eee5f7f2ee1923682eb736d856e187d960 (diff) |
Fix volume label position when its width is too short
The slider label should container size should wrap the label text when
its enabled instead of filling all available space
Flag: aconfig new_volume_panel TEAMFOOD
Test: manual on the phone and a tablet. Adjust the volume to for the
label to change side.
Fixes: 330477873
Change-Id: Ia2fdd2479ee7594a6ad7a47868bbcf5f24e333f1
-rw-r--r-- | packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSliderContent.kt | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSliderContent.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSliderContent.kt index 6b9af239eb6f..4ae4eb875953 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSliderContent.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSliderContent.kt @@ -108,15 +108,20 @@ private class VolumeSliderContentMeasurePolicy(private val isEnabled: Boolean) : measurables .fastFirst { it.layoutId == VolumeSliderContentComponent.Label } .measure(constraints) - val layoutWidth: Int = constraints.maxWidth + val layoutWidth: Int = + if (isEnabled) { + labelPlaceable.width + } else { + constraints.maxWidth + } val fullLayoutWidth: Int = if (isEnabled) { // PlatformSlider uses half of the available space for the enabled state. // This is using it to allow disabled message to take whole space when animating to // prevent it from jumping left to right - layoutWidth * 2 + constraints.maxWidth * 2 } else { - layoutWidth + constraints.maxWidth } val disabledMessagePlaceable = |