Loading packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/EditTile.kt +11 −9 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.IconButtonDefaults import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold Loading Loading @@ -280,26 +281,22 @@ fun DefaultEditTileGrid( topBar = { EditModeTopBar(onStopEditing = onStopEditing, modifier = Modifier.statusBarsPadding()) { AnimatedVisibility(snapshotViewModel.canUndo, enter = fadeIn(), exit = fadeOut()) { TextButton( IconButton( enabled = snapshotViewModel.canUndo, onClick = { selectionState.unSelect() snapshotViewModel.undo() }, colors = ButtonDefaults.textButtonColors( IconButtonDefaults.iconButtonColors( containerColor = MaterialTheme.colorScheme.primary, contentColor = MaterialTheme.colorScheme.onPrimary, ), ) { Icon( Icons.AutoMirrored.Default.Undo, contentDescription = null, modifier = Modifier.padding(end = 8.dp), ) Text( text = stringResource(id = com.android.internal.R.string.undo), style = MaterialTheme.typography.labelLarge, contentDescription = stringResource(id = com.android.internal.R.string.undo), ) } } Loading Loading @@ -523,7 +520,12 @@ private fun EditGridHeader( @Composable private fun EditGridCenteredText(text: String, modifier: Modifier = Modifier) { Text(text = text, style = MaterialTheme.typography.titleSmall, modifier = modifier) Text( text = text, style = MaterialTheme.typography.titleSmall, textAlign = TextAlign.Center, modifier = modifier, ) } @Composable Loading packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/EditModeTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -201,12 +201,12 @@ class EditModeTest : SysuiTestCase() { composeRule.onNodeWithText("tileF").performClick() // Tap to add composeRule.waitForIdle() composeRule.onNodeWithText("Undo").assertExists() composeRule.onNodeWithContentDescription("Undo").assertExists() composeRule.onNodeWithText("Undo").performClick() // Undo addition composeRule.onNodeWithContentDescription("Undo").performClick() // Undo addition composeRule.waitForIdle() composeRule.onNodeWithText("Undo").assertDoesNotExist() composeRule.onNodeWithContentDescription("Undo").assertDoesNotExist() } private fun ComposeContentTestRule.assertCurrentTilesGridContainsExactly(specs: List<String>) = Loading packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/InfiniteGridLayoutEditTileGridTest.kt +8 −8 Original line number Diff line number Diff line Loading @@ -147,14 +147,14 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { .inOrder() // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert we're back to the first move state assertThat(currentTilesInteractor.currentTilesSpecs.map { it.spec }) .containsExactlyElementsIn(stateOnFirstMove) .inOrder() // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert we're back to the initial state assertThat(currentTilesInteractor.currentTilesSpecs.map { it.spec }) .containsExactlyElementsIn(TestEditTiles.map { it.spec }) Loading Loading @@ -189,12 +189,12 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { assertThat(latest!!.find { it.tile.tileSpec == "mictoggle" }).isNotNull() // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that mictoggle is no longer current assertThat(latest!!.find { it.tile.tileSpec == "mictoggle" }).isNull() // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that rotation is no longer current assertThat(latest!!.find { it.tile.tileSpec == "rotation" }).isNull() } Loading Loading @@ -225,12 +225,12 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { assertThat(latest!!.find { it.tile.tileSpec == "bt" }).isNull() // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that bluetooth is current assertThat(latest!!.find { it.tile.tileSpec == "bt" }).isNotNull() // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that internet is current assertThat(latest!!.find { it.tile.tileSpec == "internet" }).isNotNull() } Loading Loading @@ -266,11 +266,11 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { assertLargeTiles(setOf("bt", "dnd", "cast", "flashlight")) // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() assertLargeTiles(setOf("bt", "dnd", "cast")) // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() assertLargeTiles(setOf("internet", "bt", "dnd", "cast")) assertThat(dynamicIconTilesViewModel.largeTilesState.value.map { it.spec }) .containsExactly("internet", "bt", "dnd", "cast") Loading Loading
packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/EditTile.kt +11 −9 Original line number Diff line number Diff line Loading @@ -82,6 +82,7 @@ import androidx.compose.material3.ExperimentalMaterial3Api import androidx.compose.material3.ExperimentalMaterial3ExpressiveApi import androidx.compose.material3.Icon import androidx.compose.material3.IconButton import androidx.compose.material3.IconButtonDefaults import androidx.compose.material3.LocalContentColor import androidx.compose.material3.MaterialTheme import androidx.compose.material3.Scaffold Loading Loading @@ -280,26 +281,22 @@ fun DefaultEditTileGrid( topBar = { EditModeTopBar(onStopEditing = onStopEditing, modifier = Modifier.statusBarsPadding()) { AnimatedVisibility(snapshotViewModel.canUndo, enter = fadeIn(), exit = fadeOut()) { TextButton( IconButton( enabled = snapshotViewModel.canUndo, onClick = { selectionState.unSelect() snapshotViewModel.undo() }, colors = ButtonDefaults.textButtonColors( IconButtonDefaults.iconButtonColors( containerColor = MaterialTheme.colorScheme.primary, contentColor = MaterialTheme.colorScheme.onPrimary, ), ) { Icon( Icons.AutoMirrored.Default.Undo, contentDescription = null, modifier = Modifier.padding(end = 8.dp), ) Text( text = stringResource(id = com.android.internal.R.string.undo), style = MaterialTheme.typography.labelLarge, contentDescription = stringResource(id = com.android.internal.R.string.undo), ) } } Loading Loading @@ -523,7 +520,12 @@ private fun EditGridHeader( @Composable private fun EditGridCenteredText(text: String, modifier: Modifier = Modifier) { Text(text = text, style = MaterialTheme.typography.titleSmall, modifier = modifier) Text( text = text, style = MaterialTheme.typography.titleSmall, textAlign = TextAlign.Center, modifier = modifier, ) } @Composable Loading
packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/EditModeTest.kt +3 −3 Original line number Diff line number Diff line Loading @@ -201,12 +201,12 @@ class EditModeTest : SysuiTestCase() { composeRule.onNodeWithText("tileF").performClick() // Tap to add composeRule.waitForIdle() composeRule.onNodeWithText("Undo").assertExists() composeRule.onNodeWithContentDescription("Undo").assertExists() composeRule.onNodeWithText("Undo").performClick() // Undo addition composeRule.onNodeWithContentDescription("Undo").performClick() // Undo addition composeRule.waitForIdle() composeRule.onNodeWithText("Undo").assertDoesNotExist() composeRule.onNodeWithContentDescription("Undo").assertDoesNotExist() } private fun ComposeContentTestRule.assertCurrentTilesGridContainsExactly(specs: List<String>) = Loading
packages/SystemUI/tests/src/com/android/systemui/qs/panels/ui/compose/InfiniteGridLayoutEditTileGridTest.kt +8 −8 Original line number Diff line number Diff line Loading @@ -147,14 +147,14 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { .inOrder() // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert we're back to the first move state assertThat(currentTilesInteractor.currentTilesSpecs.map { it.spec }) .containsExactlyElementsIn(stateOnFirstMove) .inOrder() // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert we're back to the initial state assertThat(currentTilesInteractor.currentTilesSpecs.map { it.spec }) .containsExactlyElementsIn(TestEditTiles.map { it.spec }) Loading Loading @@ -189,12 +189,12 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { assertThat(latest!!.find { it.tile.tileSpec == "mictoggle" }).isNotNull() // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that mictoggle is no longer current assertThat(latest!!.find { it.tile.tileSpec == "mictoggle" }).isNull() // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that rotation is no longer current assertThat(latest!!.find { it.tile.tileSpec == "rotation" }).isNull() } Loading Loading @@ -225,12 +225,12 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { assertThat(latest!!.find { it.tile.tileSpec == "bt" }).isNull() // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that bluetooth is current assertThat(latest!!.find { it.tile.tileSpec == "bt" }).isNotNull() // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() // Assert that internet is current assertThat(latest!!.find { it.tile.tileSpec == "internet" }).isNotNull() } Loading Loading @@ -266,11 +266,11 @@ class InfiniteGridLayoutEditTileGridTest : SysuiTestCase() { assertLargeTiles(setOf("bt", "dnd", "cast", "flashlight")) // Perform first undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() assertLargeTiles(setOf("bt", "dnd", "cast")) // Perform second undo composeRule.onNodeWithText("Undo").performClick() composeRule.onNodeWithContentDescription("Undo").performClick() assertLargeTiles(setOf("internet", "bt", "dnd", "cast")) assertThat(dynamicIconTilesViewModel.largeTilesState.value.map { it.spec }) .containsExactly("internet", "bt", "dnd", "cast") Loading