Loading packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/ColumnVolumeSliders.kt +28 −21 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,6 @@ import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween import androidx.compose.animation.core.updateTransition import androidx.compose.animation.expandVertically import androidx.compose.animation.expandVertically import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut Loading Loading @@ -78,7 +77,6 @@ fun ColumnVolumeSliders( modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { require(viewModels.isNotEmpty()) require(viewModels.isNotEmpty()) val transition = updateTransition(isExpanded, label = "CollapsableSliders") Column(modifier = modifier) { Column(modifier = modifier) { Box( Box( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(), Loading Loading @@ -106,8 +104,9 @@ fun ColumnVolumeSliders( sliderColors = sliderColors, sliderColors = sliderColors, ) ) } } transition.AnimatedVisibility( AnimatedVisibility( visible = { it || !isExpandable }, visible = isExpanded || !isExpandable, label = "CollapsableSliders", enter = enter = expandVertically(animationSpec = tween(durationMillis = EXPAND_DURATION_MILLIS)), expandVertically(animationSpec = tween(durationMillis = EXPAND_DURATION_MILLIS)), exit = exit = Loading @@ -120,14 +119,23 @@ fun ColumnVolumeSliders( for (index in 1..viewModels.lastIndex) { for (index in 1..viewModels.lastIndex) { val sliderViewModel: SliderViewModel = viewModels[index] val sliderViewModel: SliderViewModel = viewModels[index] val sliderState by sliderViewModel.slider.collectAsStateWithLifecycle() val sliderState by sliderViewModel.slider.collectAsStateWithLifecycle() transition.AnimatedVisibility( modifier = Modifier.padding(top = 16.dp), visible = { it || !isExpandable }, enter = enterTransition(index = index, totalCount = viewModels.size), exit = exitTransition(index = index, totalCount = viewModels.size) ) { VolumeSlider( VolumeSlider( modifier = Modifier.fillMaxWidth(), modifier = Modifier.padding(top = 16.dp) .fillMaxWidth() .animateEnterExit( enter = enterTransition( index = index, totalCount = viewModels.size, ), exit = exitTransition( index = index, totalCount = viewModels.size, ), ), state = sliderState, state = sliderState, onValueChange = { newValue: Float -> onValueChange = { newValue: Float -> sliderViewModel.onValueChanged(sliderState, newValue) sliderViewModel.onValueChanged(sliderState, newValue) Loading @@ -142,7 +150,6 @@ fun ColumnVolumeSliders( } } } } } } } @Composable @Composable private fun ExpandButton( private fun ExpandButton( Loading Loading
packages/SystemUI/compose/features/src/com/android/systemui/volume/panel/component/volume/ui/composable/ColumnVolumeSliders.kt +28 −21 Original line number Original line Diff line number Diff line Loading @@ -23,7 +23,6 @@ import androidx.compose.animation.ExperimentalAnimationApi import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.AnimationSpec import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.animateDpAsState import androidx.compose.animation.core.tween import androidx.compose.animation.core.tween import androidx.compose.animation.core.updateTransition import androidx.compose.animation.expandVertically import androidx.compose.animation.expandVertically import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeIn import androidx.compose.animation.fadeOut import androidx.compose.animation.fadeOut Loading Loading @@ -78,7 +77,6 @@ fun ColumnVolumeSliders( modifier: Modifier = Modifier, modifier: Modifier = Modifier, ) { ) { require(viewModels.isNotEmpty()) require(viewModels.isNotEmpty()) val transition = updateTransition(isExpanded, label = "CollapsableSliders") Column(modifier = modifier) { Column(modifier = modifier) { Box( Box( modifier = Modifier.fillMaxWidth(), modifier = Modifier.fillMaxWidth(), Loading Loading @@ -106,8 +104,9 @@ fun ColumnVolumeSliders( sliderColors = sliderColors, sliderColors = sliderColors, ) ) } } transition.AnimatedVisibility( AnimatedVisibility( visible = { it || !isExpandable }, visible = isExpanded || !isExpandable, label = "CollapsableSliders", enter = enter = expandVertically(animationSpec = tween(durationMillis = EXPAND_DURATION_MILLIS)), expandVertically(animationSpec = tween(durationMillis = EXPAND_DURATION_MILLIS)), exit = exit = Loading @@ -120,14 +119,23 @@ fun ColumnVolumeSliders( for (index in 1..viewModels.lastIndex) { for (index in 1..viewModels.lastIndex) { val sliderViewModel: SliderViewModel = viewModels[index] val sliderViewModel: SliderViewModel = viewModels[index] val sliderState by sliderViewModel.slider.collectAsStateWithLifecycle() val sliderState by sliderViewModel.slider.collectAsStateWithLifecycle() transition.AnimatedVisibility( modifier = Modifier.padding(top = 16.dp), visible = { it || !isExpandable }, enter = enterTransition(index = index, totalCount = viewModels.size), exit = exitTransition(index = index, totalCount = viewModels.size) ) { VolumeSlider( VolumeSlider( modifier = Modifier.fillMaxWidth(), modifier = Modifier.padding(top = 16.dp) .fillMaxWidth() .animateEnterExit( enter = enterTransition( index = index, totalCount = viewModels.size, ), exit = exitTransition( index = index, totalCount = viewModels.size, ), ), state = sliderState, state = sliderState, onValueChange = { newValue: Float -> onValueChange = { newValue: Float -> sliderViewModel.onValueChanged(sliderState, newValue) sliderViewModel.onValueChanged(sliderState, newValue) Loading @@ -142,7 +150,6 @@ fun ColumnVolumeSliders( } } } } } } } @Composable @Composable private fun ExpandButton( private fun ExpandButton( Loading