Loading packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/ColumnVolumeSliders.kt +5 −6 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.volume.panel.component.volume.ui.composable import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.tween Loading Loading @@ -70,8 +69,6 @@ private const val SHRINK_FRACTION = 0.55f private const val SCALE_FRACTION = 0.9f private const val EXPAND_BUTTON_SCALE = 0.8f /** Volume sliders laid out in a collapsable column */ @OptIn(ExperimentalAnimationApi::class) @Composable fun ColumnVolumeSliders( viewModels: List<SliderViewModel>, Loading Loading @@ -144,8 +141,7 @@ fun ColumnVolumeSliders( VolumeSlider( modifier = Modifier.padding(top = 16.dp) .fillMaxWidth() Modifier.fillMaxWidth() .animateEnterExit( enter = enterTransition( Loading @@ -157,7 +153,10 @@ fun ColumnVolumeSliders( index = index, totalCount = viewModels.size, ), ), ) .thenIf(!Flags.volumeRedesign()) { Modifier.padding(top = 16.dp) }, state = sliderState, onValueChange = { newValue: Float -> sliderViewModel.onValueChanged(sliderState, newValue) Loading packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSlider.kt +29 −2 Original line number Diff line number Diff line Loading @@ -17,10 +17,12 @@ 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.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.basicMarquee import androidx.compose.foundation.clickable import androidx.compose.foundation.gestures.Orientation import androidx.compose.foundation.interaction.MutableInteractionSource Loading @@ -33,6 +35,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.Icon as MaterialIcon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Slider import androidx.compose.material3.Text Loading @@ -47,6 +50,7 @@ import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.CustomAccessibilityAction import androidx.compose.ui.semantics.ProgressBarRangeInfo import androidx.compose.ui.semantics.clearAndSetSemantics Loading @@ -67,6 +71,7 @@ import com.android.systemui.haptics.slider.SeekableSliderTrackerConfig import com.android.systemui.haptics.slider.SliderHapticFeedbackConfig import com.android.systemui.haptics.slider.compose.ui.SliderHapticsViewModel import com.android.systemui.lifecycle.rememberViewModel import com.android.systemui.res.R import com.android.systemui.volume.panel.component.volume.slider.ui.viewmodel.SliderState import kotlin.math.round import kotlinx.coroutines.flow.distinctUntilChanged Loading Loading @@ -98,7 +103,7 @@ fun VolumeSlider( } val value by valueState(state) Column(modifier) { Column(modifier = modifier.animateContentSize(), verticalArrangement = Arrangement.Top) { Row( horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxWidth().height(40.dp), Loading Loading @@ -127,7 +132,7 @@ fun VolumeSlider( enabled = state.isEnabled, modifier = Modifier.height(40.dp) .padding(vertical = 8.dp) .padding(top = 4.dp, bottom = 12.dp) .sysuiResTag(state.label) .clearAndSetSemantics { if (state.isEnabled) { Loading Loading @@ -168,6 +173,28 @@ fun VolumeSlider( } }, ) state.disabledMessage?.let { disabledMessage -> AnimatedVisibility(visible = !state.isEnabled) { Row( modifier = Modifier.padding(bottom = 12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, ) { MaterialIcon( painter = painterResource(R.drawable.ic_error_outline), contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(16.dp), ) Text( text = disabledMessage, color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.labelSmall, modifier = Modifier.basicMarquee(), ) } } } } } Loading packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VerticalVolumePanelContent.kt +6 −7 Original line number Diff line number Diff line Loading @@ -37,20 +37,19 @@ fun VolumePanelComposeScope.VerticalVolumePanelContent( layout: ComponentsLayout, modifier: Modifier = Modifier, ) { Column( modifier = modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(20.dp), ) { Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(20.dp)) { for (component in layout.headerComponents) { AnimatedVisibility(component.isVisible) { with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) } } } Column(Modifier.verticalScroll(rememberScrollState())) { for (component in layout.contentComponents) { AnimatedVisibility(component.isVisible) { with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) } } } } AnimatedContent( targetState = layout.footerComponents, Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/ColumnVolumeSliders.kt +5 −6 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.volume.panel.component.volume.ui.composable import androidx.compose.animation.AnimatedVisibility import androidx.compose.animation.EnterTransition import androidx.compose.animation.ExitTransition import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.tween Loading Loading @@ -70,8 +69,6 @@ private const val SHRINK_FRACTION = 0.55f private const val SCALE_FRACTION = 0.9f private const val EXPAND_BUTTON_SCALE = 0.8f /** Volume sliders laid out in a collapsable column */ @OptIn(ExperimentalAnimationApi::class) @Composable fun ColumnVolumeSliders( viewModels: List<SliderViewModel>, Loading Loading @@ -144,8 +141,7 @@ fun ColumnVolumeSliders( VolumeSlider( modifier = Modifier.padding(top = 16.dp) .fillMaxWidth() Modifier.fillMaxWidth() .animateEnterExit( enter = enterTransition( Loading @@ -157,7 +153,10 @@ fun ColumnVolumeSliders( index = index, totalCount = viewModels.size, ), ), ) .thenIf(!Flags.volumeRedesign()) { Modifier.padding(top = 16.dp) }, state = sliderState, onValueChange = { newValue: Float -> sliderViewModel.onValueChanged(sliderState, newValue) Loading
packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/VolumeSlider.kt +29 −2 Original line number Diff line number Diff line Loading @@ -17,10 +17,12 @@ 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.core.tween import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.foundation.basicMarquee import androidx.compose.foundation.clickable import androidx.compose.foundation.gestures.Orientation import androidx.compose.foundation.interaction.MutableInteractionSource Loading @@ -33,6 +35,7 @@ import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.height import androidx.compose.foundation.layout.padding import androidx.compose.foundation.layout.size import androidx.compose.material3.Icon as MaterialIcon import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Slider import androidx.compose.material3.Text Loading @@ -47,6 +50,7 @@ import androidx.compose.runtime.setValue import androidx.compose.runtime.snapshotFlow import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier import androidx.compose.ui.res.painterResource import androidx.compose.ui.semantics.CustomAccessibilityAction import androidx.compose.ui.semantics.ProgressBarRangeInfo import androidx.compose.ui.semantics.clearAndSetSemantics Loading @@ -67,6 +71,7 @@ import com.android.systemui.haptics.slider.SeekableSliderTrackerConfig import com.android.systemui.haptics.slider.SliderHapticFeedbackConfig import com.android.systemui.haptics.slider.compose.ui.SliderHapticsViewModel import com.android.systemui.lifecycle.rememberViewModel import com.android.systemui.res.R import com.android.systemui.volume.panel.component.volume.slider.ui.viewmodel.SliderState import kotlin.math.round import kotlinx.coroutines.flow.distinctUntilChanged Loading Loading @@ -98,7 +103,7 @@ fun VolumeSlider( } val value by valueState(state) Column(modifier) { Column(modifier = modifier.animateContentSize(), verticalArrangement = Arrangement.Top) { Row( horizontalArrangement = Arrangement.spacedBy(12.dp), modifier = Modifier.fillMaxWidth().height(40.dp), Loading Loading @@ -127,7 +132,7 @@ fun VolumeSlider( enabled = state.isEnabled, modifier = Modifier.height(40.dp) .padding(vertical = 8.dp) .padding(top = 4.dp, bottom = 12.dp) .sysuiResTag(state.label) .clearAndSetSemantics { if (state.isEnabled) { Loading Loading @@ -168,6 +173,28 @@ fun VolumeSlider( } }, ) state.disabledMessage?.let { disabledMessage -> AnimatedVisibility(visible = !state.isEnabled) { Row( modifier = Modifier.padding(bottom = 12.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), verticalAlignment = Alignment.CenterVertically, ) { MaterialIcon( painter = painterResource(R.drawable.ic_error_outline), contentDescription = null, tint = MaterialTheme.colorScheme.onSurfaceVariant, modifier = Modifier.size(16.dp), ) Text( text = disabledMessage, color = MaterialTheme.colorScheme.onSurfaceVariant, style = MaterialTheme.typography.labelSmall, modifier = Modifier.basicMarquee(), ) } } } } } Loading
packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/ui/composable/VerticalVolumePanelContent.kt +6 −7 Original line number Diff line number Diff line Loading @@ -37,20 +37,19 @@ fun VolumePanelComposeScope.VerticalVolumePanelContent( layout: ComponentsLayout, modifier: Modifier = Modifier, ) { Column( modifier = modifier.verticalScroll(rememberScrollState()), verticalArrangement = Arrangement.spacedBy(20.dp), ) { Column(modifier = modifier, verticalArrangement = Arrangement.spacedBy(20.dp)) { for (component in layout.headerComponents) { AnimatedVisibility(component.isVisible) { with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) } } } Column(Modifier.verticalScroll(rememberScrollState())) { for (component in layout.contentComponents) { AnimatedVisibility(component.isVisible) { with(component.component as ComposeVolumePanelUiComponent) { Content(Modifier) } } } } AnimatedContent( targetState = layout.footerComponents, Loading