Loading packages/SystemUI/aconfig/systemui.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,16 @@ flag { } } flag { name: "modes_dialog_single_rows" namespace: "systemui" description: "[Experiment] Display one entry per grid row in the Modes Dialog." bug: "366034002" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "pss_app_selector_recents_split_screen" namespace: "systemui" Loading packages/SystemUI/src/com/android/systemui/statusbar/policy/ui/dialog/composable/ModeTile.kt +7 −16 Original line number Diff line number Diff line Loading @@ -59,32 +59,26 @@ fun ModeTile(viewModel: ModeTileViewModel) { ) CompositionLocalProvider(LocalContentColor provides contentColor) { Surface( color = tileColor, shape = RoundedCornerShape(16.dp), ) { Surface(color = tileColor, shape = RoundedCornerShape(16.dp)) { Row( modifier = Modifier.combinedClickable( onClick = viewModel.onClick, onLongClick = viewModel.onLongClick, onLongClickLabel = viewModel.onLongClickLabel onLongClickLabel = viewModel.onLongClickLabel, ) .padding(20.dp) .padding(16.dp) .semantics { stateDescription = viewModel.stateDescription }, verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy( space = 10.dp, alignment = Alignment.Start, ), Arrangement.spacedBy(space = 8.dp, alignment = Alignment.Start), ) { Icon(icon = viewModel.icon, modifier = Modifier.size(24.dp)) Column { Text( viewModel.text, fontWeight = FontWeight.W500, modifier = Modifier.tileMarquee().testTag("name") modifier = Modifier.tileMarquee().testTag("name"), ) Text( viewModel.subtext, Loading @@ -94,7 +88,7 @@ fun ModeTile(viewModel: ModeTileViewModel) { .testTag(if (viewModel.enabled) "stateOn" else "stateOff") .clearAndSetSemantics { contentDescription = viewModel.subtextDescription } }, ) } } Loading @@ -103,8 +97,5 @@ fun ModeTile(viewModel: ModeTileViewModel) { } private fun Modifier.tileMarquee(): Modifier { return this.basicMarquee( iterations = 1, initialDelayMillis = 200, ) return this.basicMarquee(iterations = 1) } packages/SystemUI/src/com/android/systemui/statusbar/policy/ui/dialog/composable/ModeTileGrid.kt +4 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.policy.ui.dialog.composable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.runtime.Composable Loading @@ -27,23 +26,20 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.systemui.Flags import com.android.systemui.statusbar.policy.ui.dialog.viewmodel.ModesDialogViewModel @Composable fun ModeTileGrid(viewModel: ModesDialogViewModel) { val tiles by viewModel.tiles.collectAsStateWithLifecycle(initialValue = emptyList()) // TODO(b/346519570): Handle what happens when we have more than a few modes. LazyVerticalGrid( columns = GridCells.Fixed(2), modifier = Modifier.padding(8.dp).fillMaxWidth().heightIn(max = 300.dp), columns = GridCells.Fixed(if (Flags.modesDialogSingleRows()) 1 else 2), modifier = Modifier.fillMaxWidth().heightIn(max = 300.dp), verticalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), ) { items( tiles.size, key = { index -> tiles[index].id }, ) { index -> items(tiles.size, key = { index -> tiles[index].id }) { index -> ModeTile(viewModel = tiles[index]) } } Loading Loading
packages/SystemUI/aconfig/systemui.aconfig +10 −0 Original line number Diff line number Diff line Loading @@ -148,6 +148,16 @@ flag { } } flag { name: "modes_dialog_single_rows" namespace: "systemui" description: "[Experiment] Display one entry per grid row in the Modes Dialog." bug: "366034002" metadata { purpose: PURPOSE_BUGFIX } } flag { name: "pss_app_selector_recents_split_screen" namespace: "systemui" Loading
packages/SystemUI/src/com/android/systemui/statusbar/policy/ui/dialog/composable/ModeTile.kt +7 −16 Original line number Diff line number Diff line Loading @@ -59,32 +59,26 @@ fun ModeTile(viewModel: ModeTileViewModel) { ) CompositionLocalProvider(LocalContentColor provides contentColor) { Surface( color = tileColor, shape = RoundedCornerShape(16.dp), ) { Surface(color = tileColor, shape = RoundedCornerShape(16.dp)) { Row( modifier = Modifier.combinedClickable( onClick = viewModel.onClick, onLongClick = viewModel.onLongClick, onLongClickLabel = viewModel.onLongClickLabel onLongClickLabel = viewModel.onLongClickLabel, ) .padding(20.dp) .padding(16.dp) .semantics { stateDescription = viewModel.stateDescription }, verticalAlignment = Alignment.CenterVertically, horizontalArrangement = Arrangement.spacedBy( space = 10.dp, alignment = Alignment.Start, ), Arrangement.spacedBy(space = 8.dp, alignment = Alignment.Start), ) { Icon(icon = viewModel.icon, modifier = Modifier.size(24.dp)) Column { Text( viewModel.text, fontWeight = FontWeight.W500, modifier = Modifier.tileMarquee().testTag("name") modifier = Modifier.tileMarquee().testTag("name"), ) Text( viewModel.subtext, Loading @@ -94,7 +88,7 @@ fun ModeTile(viewModel: ModeTileViewModel) { .testTag(if (viewModel.enabled) "stateOn" else "stateOff") .clearAndSetSemantics { contentDescription = viewModel.subtextDescription } }, ) } } Loading @@ -103,8 +97,5 @@ fun ModeTile(viewModel: ModeTileViewModel) { } private fun Modifier.tileMarquee(): Modifier { return this.basicMarquee( iterations = 1, initialDelayMillis = 200, ) return this.basicMarquee(iterations = 1) }
packages/SystemUI/src/com/android/systemui/statusbar/policy/ui/dialog/composable/ModeTileGrid.kt +4 −8 Original line number Diff line number Diff line Loading @@ -19,7 +19,6 @@ package com.android.systemui.statusbar.policy.ui.dialog.composable import androidx.compose.foundation.layout.Arrangement import androidx.compose.foundation.layout.fillMaxWidth import androidx.compose.foundation.layout.heightIn import androidx.compose.foundation.layout.padding import androidx.compose.foundation.lazy.grid.GridCells import androidx.compose.foundation.lazy.grid.LazyVerticalGrid import androidx.compose.runtime.Composable Loading @@ -27,23 +26,20 @@ import androidx.compose.runtime.getValue import androidx.compose.ui.Modifier import androidx.compose.ui.unit.dp import androidx.lifecycle.compose.collectAsStateWithLifecycle import com.android.systemui.Flags import com.android.systemui.statusbar.policy.ui.dialog.viewmodel.ModesDialogViewModel @Composable fun ModeTileGrid(viewModel: ModesDialogViewModel) { val tiles by viewModel.tiles.collectAsStateWithLifecycle(initialValue = emptyList()) // TODO(b/346519570): Handle what happens when we have more than a few modes. LazyVerticalGrid( columns = GridCells.Fixed(2), modifier = Modifier.padding(8.dp).fillMaxWidth().heightIn(max = 300.dp), columns = GridCells.Fixed(if (Flags.modesDialogSingleRows()) 1 else 2), modifier = Modifier.fillMaxWidth().heightIn(max = 300.dp), verticalArrangement = Arrangement.spacedBy(8.dp), horizontalArrangement = Arrangement.spacedBy(8.dp), ) { items( tiles.size, key = { index -> tiles[index].id }, ) { index -> items(tiles.size, key = { index -> tiles[index].id }) { index -> ModeTile(viewModel = tiles[index]) } } Loading