diff options
| author | 2025-02-26 16:06:32 -0500 | |
|---|---|---|
| committer | 2025-03-03 11:23:47 -0500 | |
| commit | 4496b6f94fe1d604f2e3039c30ee262ff17dbe60 (patch) | |
| tree | a4f80c6f55895f182293b65b752683d1519b8107 | |
| parent | 4991b7f260ad427e5cc9ecc18296d1b656d40c1a (diff) | |
Enable dual target UI for all large tiles
This includes edit mode
Test: manually
Test: verified with tile request service
Flag: com.android.systemui.qs_ui_refactor_compose_fragment
Fixes: 383092998
Change-Id: I6f836b45f452926fd64f9c57d029967e1cbca6fb
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt | 47 | ||||
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt | 8 |
2 files changed, 28 insertions, 27 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt index 0a256d571ec9..d5adc50c7a50 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/CommonTile.kt @@ -105,30 +105,31 @@ fun LargeTileContent( val focusBorderColor = MaterialTheme.colorScheme.secondary Box( modifier = - Modifier.size(CommonTileDefaults.ToggleTargetSize).thenIf(toggleClick != null) { - Modifier.borderOnFocus(color = focusBorderColor, iconShape.topEnd) - .clip(iconShape) - .verticalSquish(squishiness) - .drawBehind { drawRect(animatedBackgroundColor) } - .combinedClickable( - onClick = toggleClick!!, - onLongClick = onLongClick, - onLongClickLabel = longPressLabel, - hapticFeedbackEnabled = !Flags.msdlFeedback(), - ) - .thenIf(accessibilityUiState != null) { - Modifier.semantics { - accessibilityUiState as AccessibilityUiState - contentDescription = accessibilityUiState.contentDescription - stateDescription = accessibilityUiState.stateDescription - accessibilityUiState.toggleableState?.let { - toggleableState = it + Modifier.size(CommonTileDefaults.ToggleTargetSize) + .clip(iconShape) + .verticalSquish(squishiness) + .drawBehind { drawRect(animatedBackgroundColor) } + .thenIf(toggleClick != null) { + Modifier.borderOnFocus(color = focusBorderColor, iconShape.topEnd) + .combinedClickable( + onClick = toggleClick!!, + onLongClick = onLongClick, + onLongClickLabel = longPressLabel, + hapticFeedbackEnabled = !Flags.msdlFeedback(), + ) + .thenIf(accessibilityUiState != null) { + Modifier.semantics { + accessibilityUiState as AccessibilityUiState + contentDescription = accessibilityUiState.contentDescription + stateDescription = accessibilityUiState.stateDescription + accessibilityUiState.toggleableState?.let { + toggleableState = it + } + role = Role.Switch } - role = Role.Switch - } - .sysuiResTag(TEST_TAG_TOGGLE) - } - } + .sysuiResTag(TEST_TAG_TOGGLE) + } + } ) { SmallTileContent( iconProvider = iconProvider, diff --git a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt index d73dc870756b..df0e20cfcb29 100644 --- a/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt +++ b/packages/SystemUI/src/com/android/systemui/qs/panels/ui/compose/infinitegrid/Tile.kt @@ -356,10 +356,10 @@ private object TileDefaults { val ActiveIconCornerRadius = 16.dp val ActiveTileCornerRadius = 24.dp - /** An active tile without dual target uses the active color as background */ + /** An active icon tile uses the active color as background */ @Composable @ReadOnlyComposable - fun activeTileColors(): TileColors = + fun activeIconTileColors(): TileColors = TileColors( background = MaterialTheme.colorScheme.primary, iconBackground = MaterialTheme.colorScheme.primary, @@ -418,10 +418,10 @@ private object TileDefaults { fun getColorForState(uiState: TileUiState, iconOnly: Boolean): TileColors { return when (uiState.state) { STATE_ACTIVE -> { - if (uiState.handlesSecondaryClick && !iconOnly) { + if (!iconOnly) { activeDualTargetTileColors() } else { - activeTileColors() + activeIconTileColors() } } |