diff options
| author | 2024-12-27 13:26:12 +0000 | |
|---|---|---|
| committer | 2024-12-27 13:26:12 +0000 | |
| commit | 92ee3d0d5061df458f8afee28d266c67977dbad6 (patch) | |
| tree | b55403c7f997d4a0490a480634dbf68ef2d0f6c8 | |
| parent | 125d98c7650246450d646bd7d56401df6554b016 (diff) | |
Update Volume Panel dimentions for the redesign
Flag: com.android.systemui.volume_redesign
Bug: 369994101
Test: atest VolumePanelScreenshotTest
Change-Id: I91a1202fa962679779896f70fc9c90e5660811d8
| -rw-r--r-- | packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSlider.kt | 81 |
1 files changed, 43 insertions, 38 deletions
diff --git a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSlider.kt b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSlider.kt index 1480db9de701..5f991fbb50df 100644 --- a/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSlider.kt +++ b/packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSlider.kt @@ -101,20 +101,21 @@ fun VolumeSlider( Column(modifier) { Row( horizontalArrangement = Arrangement.spacedBy(12.dp), - modifier = Modifier.fillMaxWidth(), + modifier = Modifier.fillMaxWidth().height(40.dp), + verticalAlignment = Alignment.CenterVertically, ) { state.icon?.let { Icon( icon = it, tint = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.size(40.dp).padding(8.dp), + modifier = Modifier.size(24.dp), ) } Text( text = state.label, style = MaterialTheme.typography.titleMedium, color = MaterialTheme.colorScheme.onSurface, - modifier = Modifier.weight(1f).align(Alignment.CenterVertically), + modifier = Modifier.weight(1f), ) button?.invoke() } @@ -125,43 +126,47 @@ fun VolumeSlider( onValueChangeFinished = onValueChangeFinished, enabled = state.isEnabled, modifier = - Modifier.height(40.dp).sysuiResTag(state.label).clearAndSetSemantics { - if (state.isEnabled) { - contentDescription = state.label - state.a11yClickDescription?.let { - customActions = - listOf( - CustomAccessibilityAction(it) { - onIconTapped() - true - } - ) - } - - state.a11yStateDescription?.let { stateDescription = it } - progressBarRangeInfo = ProgressBarRangeInfo(state.value, state.valueRange) - } else { - disabled() - contentDescription = - state.disabledMessage?.let { "${state.label}, $it" } ?: state.label - } - setProgress { targetValue -> - val targetDirection = - when { - targetValue > value -> 1 - targetValue < value -> -1 - else -> 0 + Modifier.height(40.dp) + .padding(vertical = 8.dp) + .sysuiResTag(state.label) + .clearAndSetSemantics { + if (state.isEnabled) { + contentDescription = state.label + state.a11yClickDescription?.let { + customActions = + listOf( + CustomAccessibilityAction(it) { + onIconTapped() + true + } + ) } - val newValue = - (value + targetDirection * state.a11yStep).coerceIn( - state.valueRange.start, - state.valueRange.endInclusive, - ) - onValueChange(newValue) - true - } - }, + state.a11yStateDescription?.let { stateDescription = it } + progressBarRangeInfo = + ProgressBarRangeInfo(state.value, state.valueRange) + } else { + disabled() + contentDescription = + state.disabledMessage?.let { "${state.label}, $it" } ?: state.label + } + setProgress { targetValue -> + val targetDirection = + when { + targetValue > value -> 1 + targetValue < value -> -1 + else -> 0 + } + + val newValue = + (value + targetDirection * state.a11yStep).coerceIn( + state.valueRange.start, + state.valueRange.endInclusive, + ) + onValueChange(newValue) + true + } + }, ) } } |