Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/PagerDots.kt +17 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import androidx.compose.ui.unit.dp import kotlin.math.absoluteValue import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import platform.test.motion.compose.values.MotionTestValueKey import platform.test.motion.compose.values.motionTestValues @Composable fun PagerDots( Loading Loading @@ -93,13 +95,22 @@ fun PagerDots( } Row( modifier = modifier.wrapContentWidth().pagerDotsSemantics(pagerState, coroutineScope), modifier = modifier .motionTestValues { activeMarkerWidth exportAs PagerDotsMotionKeys.indicatorWidth } .wrapContentWidth() .pagerDotsSemantics(pagerState, coroutineScope), horizontalArrangement = spacedBy(spaceSize), verticalAlignment = Alignment.CenterVertically, ) { // This means that the active rounded rect has to be drawn between the current page // and the previous one (as we are animating back), or the current one if not transitioning val withPrevious = pagerState.currentPageOffsetFraction <= 0 || pagerState.isOverscrolling() val withPrevious by remember(pagerState) { derivedStateOf { pagerState.currentPageOffsetFraction <= 0 || pagerState.isOverscrolling() } } repeat(pagerState.pageCount) { page -> Canvas(Modifier.size(dotSize)) { val rtl = layoutDirection == LayoutDirection.Rtl Loading Loading @@ -127,6 +138,10 @@ fun PagerDots( } } object PagerDotsMotionKeys { val indicatorWidth = MotionTestValueKey<Dp>("indicatorWidth") } private fun Modifier.pagerDotsSemantics( pagerState: PagerState, coroutineScope: CoroutineScope, Loading Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/PagerDots.kt +17 −2 Original line number Diff line number Diff line Loading @@ -46,6 +46,8 @@ import androidx.compose.ui.unit.dp import kotlin.math.absoluteValue import kotlinx.coroutines.CoroutineScope import kotlinx.coroutines.launch import platform.test.motion.compose.values.MotionTestValueKey import platform.test.motion.compose.values.motionTestValues @Composable fun PagerDots( Loading Loading @@ -93,13 +95,22 @@ fun PagerDots( } Row( modifier = modifier.wrapContentWidth().pagerDotsSemantics(pagerState, coroutineScope), modifier = modifier .motionTestValues { activeMarkerWidth exportAs PagerDotsMotionKeys.indicatorWidth } .wrapContentWidth() .pagerDotsSemantics(pagerState, coroutineScope), horizontalArrangement = spacedBy(spaceSize), verticalAlignment = Alignment.CenterVertically, ) { // This means that the active rounded rect has to be drawn between the current page // and the previous one (as we are animating back), or the current one if not transitioning val withPrevious = pagerState.currentPageOffsetFraction <= 0 || pagerState.isOverscrolling() val withPrevious by remember(pagerState) { derivedStateOf { pagerState.currentPageOffsetFraction <= 0 || pagerState.isOverscrolling() } } repeat(pagerState.pageCount) { page -> Canvas(Modifier.size(dotSize)) { val rtl = layoutDirection == LayoutDirection.Rtl Loading Loading @@ -127,6 +138,10 @@ fun PagerDots( } } object PagerDotsMotionKeys { val indicatorWidth = MotionTestValueKey<Dp>("indicatorWidth") } private fun Modifier.pagerDotsSemantics( pagerState: PagerState, coroutineScope: CoroutineScope, Loading