Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/GridLayout.kt +9 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.systemui.qs.panels.ui.viewmodel.EditTileViewModel import com.android.systemui.qs.panels.ui.viewmodel.PaginatableViewModel import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel Loading @@ -28,14 +29,20 @@ import com.android.systemui.qs.pipeline.shared.TileSpec interface GridLayout { /** * [listening] can be used to compose the grid but limit when tiles should be listening. It * Displays a grid of tiles with an optional reveal animation. * * @param listening can be used to compose the grid but limit when tiles should be listening. It * should be a function tracking a snapshot state. * @param revealEffectContainer The [ElementKey] of the container driving the reveal animation. * During expansion, tiles use this container's height to compute their own, creating a * synchronized reveal effect. When `null`, the effect is disabled. */ @Composable fun ContentScope.TileGrid( tiles: List<TileViewModel>, modifier: Modifier, listening: () -> Boolean, revealEffectContainer: ElementKey? = null, ) @Composable Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/PaginatedGridLayout.kt +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import androidx.compose.ui.res.integerResource import androidx.compose.ui.unit.Velocity import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.content.state.TransitionState import com.android.compose.modifiers.padding import com.android.systemui.common.ui.compose.PagerDots Loading Loading @@ -70,6 +71,7 @@ constructor( tiles: List<TileViewModel>, modifier: Modifier, listening: () -> Boolean, revealEffectContainer: ElementKey?, ) { val viewModel = rememberViewModel(traceName = "PaginatedGridLayout-TileGrid") { Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/TileGrid.kt +17 −2 Original line number Diff line number Diff line Loading @@ -19,16 +19,31 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.systemui.qs.panels.ui.viewmodel.TileGridViewModel /** * Displays a grid of tiles with an optional reveal animation. * * @param revealEffectContainer The [ElementKey] of the container driving the reveal animation. * During expansion, tiles use this container's height to compute their own, creating a * synchronized reveal effect. When `null`, the effect is disabled. */ @Composable fun ContentScope.TileGrid( viewModel: TileGridViewModel, modifier: Modifier = Modifier, listening: () -> Boolean = { true }, revealEffectContainer: ElementKey? = null, ) { val gridLayout = viewModel.gridLayout val tiles = viewModel.tileViewModels with(gridLayout) { TileGrid(tiles, modifier, listening) } with(gridLayout) { TileGrid( tiles = tiles, modifier = modifier, listening = listening, revealEffectContainer = revealEffectContainer, ) } } packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt +5 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.util.fastMap import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.mechanics.compose.modifier.verticalTactileSurfaceReveal import com.android.mechanics.spec.builder.rememberMotionBuilderContext import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -72,6 +73,7 @@ constructor( tiles: List<TileViewModel>, modifier: Modifier, listening: () -> Boolean, revealEffectContainer: ElementKey?, ) { val viewModel = rememberViewModel(traceName = "InfiniteGridLayout.TileGrid") { Loading Loading @@ -100,7 +102,6 @@ constructor( val scope = rememberCoroutineScope() val spans by remember(sizedTiles) { derivedStateOf { sizedTiles.fastMap { it.width } } } val isDualShade = viewModel.isDualShade val motionBuilderContext = rememberMotionBuilderContext() val marginBottom = with(LocalDensity.current) { QuickSettingsShade.Dimensions.Padding.toPx() } Loading Loading @@ -135,17 +136,17 @@ constructor( isVisible = listening, requestToggleTextFeedback = textFeedbackViewModel::requestShowFeedback, modifier = if (isDualShade) { if (revealEffectContainer != null) { Modifier.verticalTactileSurfaceReveal( contentScope = this@TileGrid, motionBuilderContext = motionBuilderContext, container = QuickSettingsShade.Elements.Panel, container = revealEffectContainer, deltaY = -marginBottom, ) } else { Modifier }, verticalFadeContentReveal = isDualShade, revealEffectContainer = revealEffectContainer, ) } } Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt +4 −4 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import com.android.compose.animation.Expandable import com.android.compose.animation.bounceable import com.android.compose.animation.rememberExpandableController import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.compose.modifiers.thenIf import com.android.compose.theme.LocalAndroidColorScheme import com.android.mechanics.compose.modifier.verticalFadeContentReveal Loading @@ -102,7 +103,6 @@ import com.android.systemui.qs.panels.ui.viewmodel.toIconProvider import com.android.systemui.qs.panels.ui.viewmodel.toUiState import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.ui.composable.QuickSettingsShade import com.android.systemui.qs.ui.compose.borderOnFocus import com.android.systemui.res.R import kotlinx.coroutines.CoroutineScope Loading Loading @@ -144,7 +144,7 @@ fun ContentScope.Tile( isVisible: () -> Boolean = { true }, requestToggleTextFeedback: (TileSpec) -> Unit = {}, detailsViewModel: DetailsViewModel?, verticalFadeContentReveal: Boolean = false, revealEffectContainer: ElementKey? = null, ) { trace(tile.traceName) { val currentBounceableInfo by rememberUpdatedState(bounceableInfo) Loading Loading @@ -253,11 +253,11 @@ fun ContentScope.Tile( iconOnly = iconOnly, isDualTarget = isDualTarget, modifier = if (verticalFadeContentReveal) { if (revealEffectContainer != null) { Modifier.verticalFadeContentReveal( contentScope = this, motionBuilderContext = rememberMotionBuilderContext(), container = QuickSettingsShade.Elements.Panel, container = revealEffectContainer, ) } else { Modifier Loading Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/GridLayout.kt +9 −2 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.systemui.qs.panels.ui.viewmodel.EditTileViewModel import com.android.systemui.qs.panels.ui.viewmodel.PaginatableViewModel import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel Loading @@ -28,14 +29,20 @@ import com.android.systemui.qs.pipeline.shared.TileSpec interface GridLayout { /** * [listening] can be used to compose the grid but limit when tiles should be listening. It * Displays a grid of tiles with an optional reveal animation. * * @param listening can be used to compose the grid but limit when tiles should be listening. It * should be a function tracking a snapshot state. * @param revealEffectContainer The [ElementKey] of the container driving the reveal animation. * During expansion, tiles use this container's height to compute their own, creating a * synchronized reveal effect. When `null`, the effect is disabled. */ @Composable fun ContentScope.TileGrid( tiles: List<TileViewModel>, modifier: Modifier, listening: () -> Boolean, revealEffectContainer: ElementKey? = null, ) @Composable Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/PaginatedGridLayout.kt +2 −0 Original line number Diff line number Diff line Loading @@ -41,6 +41,7 @@ import androidx.compose.ui.res.integerResource import androidx.compose.ui.unit.Velocity import androidx.compose.ui.unit.dp import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.compose.animation.scene.content.state.TransitionState import com.android.compose.modifiers.padding import com.android.systemui.common.ui.compose.PagerDots Loading Loading @@ -70,6 +71,7 @@ constructor( tiles: List<TileViewModel>, modifier: Modifier, listening: () -> Boolean, revealEffectContainer: ElementKey?, ) { val viewModel = rememberViewModel(traceName = "PaginatedGridLayout-TileGrid") { Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/TileGrid.kt +17 −2 Original line number Diff line number Diff line Loading @@ -19,16 +19,31 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.runtime.Composable import androidx.compose.ui.Modifier import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.systemui.qs.panels.ui.viewmodel.TileGridViewModel /** * Displays a grid of tiles with an optional reveal animation. * * @param revealEffectContainer The [ElementKey] of the container driving the reveal animation. * During expansion, tiles use this container's height to compute their own, creating a * synchronized reveal effect. When `null`, the effect is disabled. */ @Composable fun ContentScope.TileGrid( viewModel: TileGridViewModel, modifier: Modifier = Modifier, listening: () -> Boolean = { true }, revealEffectContainer: ElementKey? = null, ) { val gridLayout = viewModel.gridLayout val tiles = viewModel.tileViewModels with(gridLayout) { TileGrid(tiles, modifier, listening) } with(gridLayout) { TileGrid( tiles = tiles, modifier = modifier, listening = listening, revealEffectContainer = revealEffectContainer, ) } }
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt +5 −4 Original line number Diff line number Diff line Loading @@ -31,6 +31,7 @@ import androidx.compose.ui.res.dimensionResource import androidx.compose.ui.util.fastMap import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.mechanics.compose.modifier.verticalTactileSurfaceReveal import com.android.mechanics.spec.builder.rememberMotionBuilderContext import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -72,6 +73,7 @@ constructor( tiles: List<TileViewModel>, modifier: Modifier, listening: () -> Boolean, revealEffectContainer: ElementKey?, ) { val viewModel = rememberViewModel(traceName = "InfiniteGridLayout.TileGrid") { Loading Loading @@ -100,7 +102,6 @@ constructor( val scope = rememberCoroutineScope() val spans by remember(sizedTiles) { derivedStateOf { sizedTiles.fastMap { it.width } } } val isDualShade = viewModel.isDualShade val motionBuilderContext = rememberMotionBuilderContext() val marginBottom = with(LocalDensity.current) { QuickSettingsShade.Dimensions.Padding.toPx() } Loading Loading @@ -135,17 +136,17 @@ constructor( isVisible = listening, requestToggleTextFeedback = textFeedbackViewModel::requestShowFeedback, modifier = if (isDualShade) { if (revealEffectContainer != null) { Modifier.verticalTactileSurfaceReveal( contentScope = this@TileGrid, motionBuilderContext = motionBuilderContext, container = QuickSettingsShade.Elements.Panel, container = revealEffectContainer, deltaY = -marginBottom, ) } else { Modifier }, verticalFadeContentReveal = isDualShade, revealEffectContainer = revealEffectContainer, ) } } Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt +4 −4 Original line number Diff line number Diff line Loading @@ -76,6 +76,7 @@ import com.android.compose.animation.Expandable import com.android.compose.animation.bounceable import com.android.compose.animation.rememberExpandableController import com.android.compose.animation.scene.ContentScope import com.android.compose.animation.scene.ElementKey import com.android.compose.modifiers.thenIf import com.android.compose.theme.LocalAndroidColorScheme import com.android.mechanics.compose.modifier.verticalFadeContentReveal Loading @@ -102,7 +103,6 @@ import com.android.systemui.qs.panels.ui.viewmodel.toIconProvider import com.android.systemui.qs.panels.ui.viewmodel.toUiState import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.qs.tileimpl.QSTileImpl import com.android.systemui.qs.ui.composable.QuickSettingsShade import com.android.systemui.qs.ui.compose.borderOnFocus import com.android.systemui.res.R import kotlinx.coroutines.CoroutineScope Loading Loading @@ -144,7 +144,7 @@ fun ContentScope.Tile( isVisible: () -> Boolean = { true }, requestToggleTextFeedback: (TileSpec) -> Unit = {}, detailsViewModel: DetailsViewModel?, verticalFadeContentReveal: Boolean = false, revealEffectContainer: ElementKey? = null, ) { trace(tile.traceName) { val currentBounceableInfo by rememberUpdatedState(bounceableInfo) Loading Loading @@ -253,11 +253,11 @@ fun ContentScope.Tile( iconOnly = iconOnly, isDualTarget = isDualTarget, modifier = if (verticalFadeContentReveal) { if (revealEffectContainer != null) { Modifier.verticalFadeContentReveal( contentScope = this, motionBuilderContext = rememberMotionBuilderContext(), container = QuickSettingsShade.Elements.Panel, container = revealEffectContainer, ) } else { Modifier Loading