Loading packages/SystemUI/src/com/android/systemui/grid/ui/compose/SpannedGrids.kt +18 −10 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.runtime.Composable import androidx.compose.runtime.key import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout Loading Loading @@ -63,6 +64,7 @@ fun HorizontalSpannedGrid( rowSpacing: Dp, spans: List<Int>, modifier: Modifier = Modifier, keys: (spanIndex: Int) -> Any = { it }, composables: @Composable BoxScope.(spanIndex: Int) -> Unit, ) { SpannedGrid( Loading @@ -72,6 +74,7 @@ fun HorizontalSpannedGrid( spans = spans, isVertical = false, modifier = modifier, keys = keys, composables = composables, ) } Loading Loading @@ -103,6 +106,7 @@ fun VerticalSpannedGrid( rowSpacing: Dp, spans: List<Int>, modifier: Modifier = Modifier, keys: (spanIndex: Int) -> Any = { it }, composables: @Composable BoxScope.(spanIndex: Int) -> Unit, ) { SpannedGrid( Loading @@ -112,6 +116,7 @@ fun VerticalSpannedGrid( spans = spans, isVertical = true, modifier = modifier, keys = keys, composables = composables, ) } Loading @@ -124,6 +129,7 @@ private fun SpannedGrid( spans: List<Int>, isVertical: Boolean, modifier: Modifier = Modifier, keys: (spanIndex: Int) -> Any = { it }, composables: @Composable BoxScope.(spanIndex: Int) -> Unit, ) { val crossAxisArrangement = Arrangement.spacedBy(crossAxisSpacing) Loading Loading @@ -167,6 +173,7 @@ private fun SpannedGrid( Layout( { (0 until spans.size).map { spanIndex -> key(keys(spanIndex)) { Box( Modifier.semantics { collectionItemInfo = Loading @@ -180,6 +187,7 @@ private fun SpannedGrid( composables(spanIndex) } } } }, modifier.semantics { collectionInfo = CollectionInfo(spans.size, 1) }, ) { measurables, constraints -> Loading packages/SystemUI/src/com/android/systemui/haptics/msdl/qs/TileHapticsViewModel.kt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.haptics.msdl.qs import android.service.quicksettings.Tile import androidx.compose.runtime.Stable import com.android.systemui.Flags import com.android.systemui.animation.Expandable import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -175,6 +176,7 @@ constructor( } @SysUISingleton @Stable class TileHapticsViewModelFactoryProvider @Inject constructor(private val tileHapticsViewModelFactory: TileHapticsViewModel.Factory) { Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/BounceableInfo.kt +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.systemui.qs.panels.ui.compose import android.processor.immutability.Immutable import androidx.compose.runtime.Stable import com.android.compose.animation.Bounceable import com.android.systemui.qs.panels.shared.model.SizedTile import com.android.systemui.qs.panels.ui.model.GridCell Loading @@ -24,7 +24,7 @@ import com.android.systemui.qs.panels.ui.model.TileGridCell import com.android.systemui.qs.panels.ui.viewmodel.BounceableTileViewModel import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel @Immutable @Stable data class BounceableInfo( val bounceable: BounceableTileViewModel, val previousTile: Bounceable?, Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/QuickQuickSettings.kt +16 −16 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.foundation.layout.Box import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier Loading Loading @@ -49,6 +49,8 @@ fun ContentScope.QuickQuickSettings( val squishiness by viewModel.squishinessViewModel.squishiness.collectAsStateWithLifecycle() val scope = rememberCoroutineScope() val spans by remember(sizedTiles) { derivedStateOf { sizedTiles.fastMap { it.width } } } DisposableEffect(tiles) { val token = Any() tiles.forEach { it.startListening(token) } Loading @@ -62,13 +64,13 @@ fun ContentScope.QuickQuickSettings( columns = columns, columnSpacing = dimensionResource(R.dimen.qs_tile_margin_horizontal), rowSpacing = dimensionResource(R.dimen.qs_tile_margin_vertical), spans = sizedTiles.fastMap { it.width }, spans = spans, modifier = Modifier.sysuiResTag("qqs_tile_layout"), keys = { sizedTiles[it].tile.spec }, ) { spanIndex -> val it = sizedTiles[spanIndex] val column = cellIndex % columns cellIndex += it.width key(it.tile.spec) { Tile( tile = it.tile, iconOnly = it.isIcon, Loading @@ -76,12 +78,10 @@ fun ContentScope.QuickQuickSettings( squishiness = { squishiness }, coroutineScope = scope, bounceableInfo = bounceables.bounceableInfo(it, spanIndex, column, columns), tileHapticsViewModelFactoryProvider = viewModel.tileHapticsViewModelFactoryProvider, tileHapticsViewModelFactoryProvider = viewModel.tileHapticsViewModelFactoryProvider, // There should be no QuickQuickSettings when the details view is enabled. detailsViewModel = null, ) } } } } packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt +15 −14 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ package com.android.systemui.qs.panels.ui.compose.infinitegrid import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier Loading Loading @@ -86,16 +86,18 @@ constructor( val scope = rememberCoroutineScope() var cellIndex = 0 val spans by remember(sizedTiles) { derivedStateOf { sizedTiles.fastMap { it.width } } } VerticalSpannedGrid( columns = columns, columnSpacing = dimensionResource(R.dimen.qs_tile_margin_horizontal), rowSpacing = dimensionResource(R.dimen.qs_tile_margin_vertical), spans = sizedTiles.fastMap { it.width }, spans = spans, keys = { sizedTiles[it].tile.spec }, ) { spanIndex -> val it = sizedTiles[spanIndex] val column = cellIndex % columns cellIndex += it.width key(it.tile.spec) { Tile( tile = it.tile, iconOnly = iconTilesViewModel.isIconTile(it.tile.spec), Loading @@ -108,7 +110,6 @@ constructor( ) } } } @Composable override fun EditTileGrid( Loading Loading
packages/SystemUI/src/com/android/systemui/grid/ui/compose/SpannedGrids.kt +18 −10 Original line number Diff line number Diff line Loading @@ -20,6 +20,7 @@ import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.Box import androidx.compose.foundation.layout.BoxScope import androidx.compose.runtime.Composable import androidx.compose.runtime.key import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.layout.Layout Loading Loading @@ -63,6 +64,7 @@ fun HorizontalSpannedGrid( rowSpacing: Dp, spans: List<Int>, modifier: Modifier = Modifier, keys: (spanIndex: Int) -> Any = { it }, composables: @Composable BoxScope.(spanIndex: Int) -> Unit, ) { SpannedGrid( Loading @@ -72,6 +74,7 @@ fun HorizontalSpannedGrid( spans = spans, isVertical = false, modifier = modifier, keys = keys, composables = composables, ) } Loading Loading @@ -103,6 +106,7 @@ fun VerticalSpannedGrid( rowSpacing: Dp, spans: List<Int>, modifier: Modifier = Modifier, keys: (spanIndex: Int) -> Any = { it }, composables: @Composable BoxScope.(spanIndex: Int) -> Unit, ) { SpannedGrid( Loading @@ -112,6 +116,7 @@ fun VerticalSpannedGrid( spans = spans, isVertical = true, modifier = modifier, keys = keys, composables = composables, ) } Loading @@ -124,6 +129,7 @@ private fun SpannedGrid( spans: List<Int>, isVertical: Boolean, modifier: Modifier = Modifier, keys: (spanIndex: Int) -> Any = { it }, composables: @Composable BoxScope.(spanIndex: Int) -> Unit, ) { val crossAxisArrangement = Arrangement.spacedBy(crossAxisSpacing) Loading Loading @@ -167,6 +173,7 @@ private fun SpannedGrid( Layout( { (0 until spans.size).map { spanIndex -> key(keys(spanIndex)) { Box( Modifier.semantics { collectionItemInfo = Loading @@ -180,6 +187,7 @@ private fun SpannedGrid( composables(spanIndex) } } } }, modifier.semantics { collectionInfo = CollectionInfo(spans.size, 1) }, ) { measurables, constraints -> Loading
packages/SystemUI/src/com/android/systemui/haptics/msdl/qs/TileHapticsViewModel.kt +2 −0 Original line number Diff line number Diff line Loading @@ -17,6 +17,7 @@ package com.android.systemui.haptics.msdl.qs import android.service.quicksettings.Tile import androidx.compose.runtime.Stable import com.android.systemui.Flags import com.android.systemui.animation.Expandable import com.android.systemui.dagger.SysUISingleton Loading Loading @@ -175,6 +176,7 @@ constructor( } @SysUISingleton @Stable class TileHapticsViewModelFactoryProvider @Inject constructor(private val tileHapticsViewModelFactory: TileHapticsViewModel.Factory) { Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/BounceableInfo.kt +2 −2 Original line number Diff line number Diff line Loading @@ -16,7 +16,7 @@ package com.android.systemui.qs.panels.ui.compose import android.processor.immutability.Immutable import androidx.compose.runtime.Stable import com.android.compose.animation.Bounceable import com.android.systemui.qs.panels.shared.model.SizedTile import com.android.systemui.qs.panels.ui.model.GridCell Loading @@ -24,7 +24,7 @@ import com.android.systemui.qs.panels.ui.model.TileGridCell import com.android.systemui.qs.panels.ui.viewmodel.BounceableTileViewModel import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel @Immutable @Stable data class BounceableInfo( val bounceable: BounceableTileViewModel, val previousTile: Bounceable?, Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/QuickQuickSettings.kt +16 −16 Original line number Diff line number Diff line Loading @@ -19,8 +19,8 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.foundation.layout.Box import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier Loading Loading @@ -49,6 +49,8 @@ fun ContentScope.QuickQuickSettings( val squishiness by viewModel.squishinessViewModel.squishiness.collectAsStateWithLifecycle() val scope = rememberCoroutineScope() val spans by remember(sizedTiles) { derivedStateOf { sizedTiles.fastMap { it.width } } } DisposableEffect(tiles) { val token = Any() tiles.forEach { it.startListening(token) } Loading @@ -62,13 +64,13 @@ fun ContentScope.QuickQuickSettings( columns = columns, columnSpacing = dimensionResource(R.dimen.qs_tile_margin_horizontal), rowSpacing = dimensionResource(R.dimen.qs_tile_margin_vertical), spans = sizedTiles.fastMap { it.width }, spans = spans, modifier = Modifier.sysuiResTag("qqs_tile_layout"), keys = { sizedTiles[it].tile.spec }, ) { spanIndex -> val it = sizedTiles[spanIndex] val column = cellIndex % columns cellIndex += it.width key(it.tile.spec) { Tile( tile = it.tile, iconOnly = it.isIcon, Loading @@ -76,12 +78,10 @@ fun ContentScope.QuickQuickSettings( squishiness = { squishiness }, coroutineScope = scope, bounceableInfo = bounceables.bounceableInfo(it, spanIndex, column, columns), tileHapticsViewModelFactoryProvider = viewModel.tileHapticsViewModelFactoryProvider, tileHapticsViewModelFactoryProvider = viewModel.tileHapticsViewModelFactoryProvider, // There should be no QuickQuickSettings when the details view is enabled. detailsViewModel = null, ) } } } }
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/InfiniteGridLayout.kt +15 −14 Original line number Diff line number Diff line Loading @@ -18,8 +18,8 @@ package com.android.systemui.qs.panels.ui.compose.infinitegrid import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.derivedStateOf import androidx.compose.runtime.getValue import androidx.compose.runtime.key import androidx.compose.runtime.remember import androidx.compose.runtime.rememberCoroutineScope import androidx.compose.ui.Modifier Loading Loading @@ -86,16 +86,18 @@ constructor( val scope = rememberCoroutineScope() var cellIndex = 0 val spans by remember(sizedTiles) { derivedStateOf { sizedTiles.fastMap { it.width } } } VerticalSpannedGrid( columns = columns, columnSpacing = dimensionResource(R.dimen.qs_tile_margin_horizontal), rowSpacing = dimensionResource(R.dimen.qs_tile_margin_vertical), spans = sizedTiles.fastMap { it.width }, spans = spans, keys = { sizedTiles[it].tile.spec }, ) { spanIndex -> val it = sizedTiles[spanIndex] val column = cellIndex % columns cellIndex += it.width key(it.tile.spec) { Tile( tile = it.tile, iconOnly = iconTilesViewModel.isIconTile(it.tile.spec), Loading @@ -108,7 +110,6 @@ constructor( ) } } } @Composable override fun EditTileGrid( Loading