Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/InfiniteGridLayout.kt +1 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.runtime.Composable Loading @@ -24,7 +23,6 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.res.dimensionResource import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.systemui.dagger.SysUISingleton import com.android.systemui.qs.panels.shared.model.SizedTileImpl Loading @@ -33,7 +31,6 @@ import com.android.systemui.qs.panels.ui.viewmodel.FixedColumnsSizeViewModel import com.android.systemui.qs.panels.ui.viewmodel.IconTilesViewModel import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.res.R import javax.inject.Inject @SysUISingleton Loading Loading @@ -64,7 +61,7 @@ constructor( Tile( tile = sizedTiles[index].tile, iconOnly = iconTilesViewModel.isIconTile(sizedTiles[index].tile.spec), modifier = Modifier.height(dimensionResource(id = R.dimen.qs_tile_height)) modifier = Modifier ) } } Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/QuickQuickSettings.kt +1 −8 Original line number Diff line number Diff line Loading @@ -16,18 +16,15 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.dimensionResource import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.systemui.compose.modifiers.sysuiResTag import com.android.systemui.qs.panels.ui.viewmodel.QuickQuickSettingsViewModel import com.android.systemui.res.R @Composable fun QuickQuickSettings( Loading @@ -54,11 +51,7 @@ fun QuickQuickSettings( key = { index -> sizedTiles[index].tile.spec.spec }, span = { index -> GridItemSpan(sizedTiles[index].width) } ) { index -> Tile( tile = tiles[index], iconOnly = sizedTiles[index].isIcon, modifier = Modifier.height(dimensionResource(id = R.dimen.qs_tile_height)) ) Tile(tile = tiles[index], iconOnly = sizedTiles[index].isIcon, modifier = Modifier) } } } packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/Tile.kt +19 −17 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth Loading Loading @@ -136,23 +135,23 @@ fun Tile( // TODO(b/361789146): Draw the shapes instead of clipping val tileShape = TileDefaults.animateTileShape(uiState.state) val iconShape = TileDefaults.animateIconShape(uiState.state) TileContainer( colors = colors, showLabels = showLabels, label = uiState.label, iconOnly = iconOnly, shape = if (iconOnly) iconShape else tileShape, shape = tileShape, clickEnabled = true, onClick = tile::onClick, onLongClick = tile::onLongClick, modifier = modifier, modifier = modifier.height(tileHeight()), ) { val icon = getTileIcon(icon = uiState.icon) if (iconOnly) { TileIcon(icon = icon, color = colors.icon, modifier = Modifier.align(Alignment.Center)) } else { val iconShape = TileDefaults.animateIconShape(uiState.state) LargeTileContent( label = uiState.label, secondaryLabel = uiState.secondaryLabel, Loading Loading @@ -199,7 +198,7 @@ private fun TileContainer( Expandable( color = backgroundColor, shape = shape, modifier = Modifier.height(dimensionResource(id = R.dimen.qs_tile_height)).clip(shape) modifier = Modifier.height(tileHeight()).clip(shape) ) { Box( modifier = Loading Loading @@ -246,7 +245,7 @@ private fun LargeTileContent( // Icon Box( modifier = Modifier.fillMaxHeight().aspectRatio(1f).thenIf(toggleClickSupported) { Modifier.size(TileDefaults.ToggleTargetSize).thenIf(toggleClickSupported) { Modifier.clip(iconShape) .background(colors.iconBackground, { 1f }) .combinedClickable(onClick = onClick, onLongClick = onLongClick) Loading Loading @@ -673,7 +672,7 @@ private fun TileIcon( animateToEnd: Boolean = false, modifier: Modifier = Modifier, ) { val iconModifier = modifier.size(dimensionResource(id = R.dimen.qs_icon_size)) val iconModifier = modifier.size(TileDefaults.IconSize) val context = LocalContext.current val loadedDrawable = remember(icon, context) { Loading Loading @@ -710,17 +709,12 @@ private fun TileIcon( } } @Composable private fun Modifier.tilePadding(): Modifier { return padding(dimensionResource(id = R.dimen.qs_label_container_margin)) return padding(TileDefaults.TilePadding) } @Composable private fun tileHorizontalArrangement(): Arrangement.Horizontal { return spacedBy( space = dimensionResource(id = R.dimen.qs_label_container_margin), alignment = Alignment.Start ) return spacedBy(space = TileDefaults.TileArrangementPadding, alignment = Alignment.Start) } @Composable Loading @@ -728,7 +722,7 @@ fun tileHeight(iconWithLabel: Boolean = false): Dp { return if (iconWithLabel) { TileDefaults.IconTileWithLabelHeight } else { dimensionResource(id = R.dimen.qs_tile_height) TileDefaults.TileHeight } } Loading @@ -749,6 +743,14 @@ private object TileDefaults { val InactiveCornerRadius = 50.dp val ActiveIconCornerRadius = 16.dp val ActiveTileCornerRadius = 24.dp val ToggleTargetSize = 56.dp val IconSize = 24.dp val TilePadding = 8.dp val TileArrangementPadding = 6.dp val TileHeight = 72.dp val IconTileWithLabelHeight = 140.dp /** An active tile without dual target uses the active color as background */ Loading Loading @@ -812,7 +814,7 @@ private object TileDefaults { fun animateIconShape(state: Int): Shape { return animateShape( state = state, activeCornerRadius = ActiveTileCornerRadius, activeCornerRadius = ActiveIconCornerRadius, label = "QSTileCornerRadius", ) } Loading @@ -821,7 +823,7 @@ private object TileDefaults { fun animateTileShape(state: Int): Shape { return animateShape( state = state, activeCornerRadius = ActiveIconCornerRadius, activeCornerRadius = ActiveTileCornerRadius, label = "QSTileIconCornerRadius", ) } Loading Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/InfiniteGridLayout.kt +1 −4 Original line number Diff line number Diff line Loading @@ -16,7 +16,6 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.runtime.Composable Loading @@ -24,7 +23,6 @@ import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.getValue import androidx.compose.runtime.remember import androidx.compose.ui.Modifier import androidx.compose.ui.res.dimensionResource import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.systemui.dagger.SysUISingleton import com.android.systemui.qs.panels.shared.model.SizedTileImpl Loading @@ -33,7 +31,6 @@ import com.android.systemui.qs.panels.ui.viewmodel.FixedColumnsSizeViewModel import com.android.systemui.qs.panels.ui.viewmodel.IconTilesViewModel import com.android.systemui.qs.panels.ui.viewmodel.TileViewModel import com.android.systemui.qs.pipeline.shared.TileSpec import com.android.systemui.res.R import javax.inject.Inject @SysUISingleton Loading Loading @@ -64,7 +61,7 @@ constructor( Tile( tile = sizedTiles[index].tile, iconOnly = iconTilesViewModel.isIconTile(sizedTiles[index].tile.spec), modifier = Modifier.height(dimensionResource(id = R.dimen.qs_tile_height)) modifier = Modifier ) } } Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/QuickQuickSettings.kt +1 −8 Original line number Diff line number Diff line Loading @@ -16,18 +16,15 @@ package com.android.systemui.qs.panels.ui.compose import androidx.compose.foundation.layout.height import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.GridItemSpan import androidx.compose.runtime.Composable import androidx.compose.runtime.DisposableEffect import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.res.dimensionResource import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.systemui.compose.modifiers.sysuiResTag import com.android.systemui.qs.panels.ui.viewmodel.QuickQuickSettingsViewModel import com.android.systemui.res.R @Composable fun QuickQuickSettings( Loading @@ -54,11 +51,7 @@ fun QuickQuickSettings( key = { index -> sizedTiles[index].tile.spec.spec }, span = { index -> GridItemSpan(sizedTiles[index].width) } ) { index -> Tile( tile = tiles[index], iconOnly = sizedTiles[index].isIcon, modifier = Modifier.height(dimensionResource(id = R.dimen.qs_tile_height)) ) Tile(tile = tiles[index], iconOnly = sizedTiles[index].isIcon, modifier = Modifier) } } }
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/Tile.kt +19 −17 Original line number Diff line number Diff line Loading @@ -44,7 +44,6 @@ import androidx.compose.foundation.layout.BoxScope import androidx.compose.foundation.layout.Column import androidx.compose.foundation.layout.Row import androidx.compose.foundation.layout.Spacer import androidx.compose.foundation.layout.aspectRatio import androidx.compose.foundation.layout.fillMaxHeight import androidx.compose.foundation.layout.fillMaxSize import androidx.compose.foundation.layout.fillMaxWidth Loading Loading @@ -136,23 +135,23 @@ fun Tile( // TODO(b/361789146): Draw the shapes instead of clipping val tileShape = TileDefaults.animateTileShape(uiState.state) val iconShape = TileDefaults.animateIconShape(uiState.state) TileContainer( colors = colors, showLabels = showLabels, label = uiState.label, iconOnly = iconOnly, shape = if (iconOnly) iconShape else tileShape, shape = tileShape, clickEnabled = true, onClick = tile::onClick, onLongClick = tile::onLongClick, modifier = modifier, modifier = modifier.height(tileHeight()), ) { val icon = getTileIcon(icon = uiState.icon) if (iconOnly) { TileIcon(icon = icon, color = colors.icon, modifier = Modifier.align(Alignment.Center)) } else { val iconShape = TileDefaults.animateIconShape(uiState.state) LargeTileContent( label = uiState.label, secondaryLabel = uiState.secondaryLabel, Loading Loading @@ -199,7 +198,7 @@ private fun TileContainer( Expandable( color = backgroundColor, shape = shape, modifier = Modifier.height(dimensionResource(id = R.dimen.qs_tile_height)).clip(shape) modifier = Modifier.height(tileHeight()).clip(shape) ) { Box( modifier = Loading Loading @@ -246,7 +245,7 @@ private fun LargeTileContent( // Icon Box( modifier = Modifier.fillMaxHeight().aspectRatio(1f).thenIf(toggleClickSupported) { Modifier.size(TileDefaults.ToggleTargetSize).thenIf(toggleClickSupported) { Modifier.clip(iconShape) .background(colors.iconBackground, { 1f }) .combinedClickable(onClick = onClick, onLongClick = onLongClick) Loading Loading @@ -673,7 +672,7 @@ private fun TileIcon( animateToEnd: Boolean = false, modifier: Modifier = Modifier, ) { val iconModifier = modifier.size(dimensionResource(id = R.dimen.qs_icon_size)) val iconModifier = modifier.size(TileDefaults.IconSize) val context = LocalContext.current val loadedDrawable = remember(icon, context) { Loading Loading @@ -710,17 +709,12 @@ private fun TileIcon( } } @Composable private fun Modifier.tilePadding(): Modifier { return padding(dimensionResource(id = R.dimen.qs_label_container_margin)) return padding(TileDefaults.TilePadding) } @Composable private fun tileHorizontalArrangement(): Arrangement.Horizontal { return spacedBy( space = dimensionResource(id = R.dimen.qs_label_container_margin), alignment = Alignment.Start ) return spacedBy(space = TileDefaults.TileArrangementPadding, alignment = Alignment.Start) } @Composable Loading @@ -728,7 +722,7 @@ fun tileHeight(iconWithLabel: Boolean = false): Dp { return if (iconWithLabel) { TileDefaults.IconTileWithLabelHeight } else { dimensionResource(id = R.dimen.qs_tile_height) TileDefaults.TileHeight } } Loading @@ -749,6 +743,14 @@ private object TileDefaults { val InactiveCornerRadius = 50.dp val ActiveIconCornerRadius = 16.dp val ActiveTileCornerRadius = 24.dp val ToggleTargetSize = 56.dp val IconSize = 24.dp val TilePadding = 8.dp val TileArrangementPadding = 6.dp val TileHeight = 72.dp val IconTileWithLabelHeight = 140.dp /** An active tile without dual target uses the active color as background */ Loading Loading @@ -812,7 +814,7 @@ private object TileDefaults { fun animateIconShape(state: Int): Shape { return animateShape( state = state, activeCornerRadius = ActiveTileCornerRadius, activeCornerRadius = ActiveIconCornerRadius, label = "QSTileCornerRadius", ) } Loading @@ -821,7 +823,7 @@ private object TileDefaults { fun animateTileShape(state: Int): Shape { return animateShape( state = state, activeCornerRadius = ActiveIconCornerRadius, activeCornerRadius = ActiveTileCornerRadius, label = "QSTileIconCornerRadius", ) } Loading