summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Anton Potapov <apotapov@google.com> 2024-03-22 10:38:36 +0000
committer Android (Google) Code Review <android-gerrit@google.com> 2024-03-22 10:38:36 +0000
commit1533eb8de0882b5e43c60e824a69eedc8424b597 (patch)
treea620fdb1926efa988632f7d9a1c287fe82508ff6
parent3ef27454882313a89bc6ad84a7ff28307008f7d1 (diff)
parent7c975ff02540888c699eb24782eb874b692ceca6 (diff)
Merge "Fix volume label position when its width is too short" into main
-rw-r--r--packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSliderContent.kt11
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 =