Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/Chip.kt +2 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ fun Chip(action: ActionViewModel, modifier: Modifier = Modifier) { (MaterialTheme.typography.labelLarge.fontSize.value * fontScale).dp.toSp() }, ) val autofillActionLabel = stringResource(id = R.string.ambient_cue_autofill_action) val haptics = LocalHapticFeedback.current Row( Loading @@ -79,6 +80,7 @@ fun Chip(action: ActionViewModel, modifier: Modifier = Modifier) { .defaultMinSize(minHeight = 48.dp) .widthIn(max = 288.dp) .combinedClickable( onClickLabel = autofillActionLabel, onClick = { haptics.performHapticFeedback(HapticFeedbackType.Confirm) action.onClick() Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +21 −2 Original line number Diff line number Diff line Loading @@ -208,6 +208,9 @@ fun NavBarPill( ) { val closeButtonSize = 28.dp val closeButtonTouchTargetSize = 36.dp val filteredActions = FilterUtils.filterActions(actions) val expandActionLabel = stringResource(id = R.string.ambient_cue_expand_action) Spacer(modifier = Modifier.size(closeButtonTouchTargetSize)) Box { Loading @@ -223,13 +226,29 @@ fun NavBarPill( cornerRadius = 16.dp, visible = visible, ) .then(if (expanded) Modifier else Modifier.clickable { onClick() }) .then( if (expanded) Modifier else Modifier.clickable( // Set expand action when the action is not one-tap action. onClickLabel = if ( filteredActions.size == 1 && filteredActions[0].actionType == ActionType.MA && filteredActions[0].oneTapEnabled ) null else expandActionLabel ) { onClick() } ) .padding(2.dp) .onGloballyPositioned { expandedSize = it.size }, ) { // Should have at most 1 expanded chip var expandedChip = false val filteredActions = FilterUtils.filterActions(actions) filteredActions.fastForEachIndexed { index, action -> val isMrAction = action.actionType == ActionType.MR Loading packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +11 −0 Original line number Diff line number Diff line Loading @@ -201,6 +201,7 @@ fun ShortPill( .padding(4.dp) val filteredActions = FilterUtils.filterActions(actions) val expandActionLabel = stringResource(id = R.string.ambient_cue_expand_action) // The layout for the un-expanded state (pill + side button) if (horizontal) { Loading @@ -222,6 +223,16 @@ fun ShortPill( Modifier.clickable( indication = null, interactionSource = null, // Set expand action when the action is not one-tap action. onClickLabel = if ( filteredActions.size == 1 && filteredActions[0].actionType == ActionType.MA && filteredActions[0].oneTapEnabled ) null else expandActionLabel, ) { onClick() } Loading packages/SystemUI/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -4465,4 +4465,10 @@ <!-- Content description for arrow in Pager Dots to navigate to next page [CHAR LIMIT=NONE] --> <string name="pager_dots_next_content_description">Next</string> <!-- Description for the Ambient Cue accessibility action label for autofilling. [CHAR LIMIT=NONE] --> <string name="ambient_cue_autofill_action">autofill</string> <!-- Description for the Ambient Cue accessibility action label for expanding. [CHAR LIMIT=NONE] --> <string name="ambient_cue_expand_action">expand</string> </resources> Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/Chip.kt +2 −0 Original line number Diff line number Diff line Loading @@ -67,6 +67,7 @@ fun Chip(action: ActionViewModel, modifier: Modifier = Modifier) { (MaterialTheme.typography.labelLarge.fontSize.value * fontScale).dp.toSp() }, ) val autofillActionLabel = stringResource(id = R.string.ambient_cue_autofill_action) val haptics = LocalHapticFeedback.current Row( Loading @@ -79,6 +80,7 @@ fun Chip(action: ActionViewModel, modifier: Modifier = Modifier) { .defaultMinSize(minHeight = 48.dp) .widthIn(max = 288.dp) .combinedClickable( onClickLabel = autofillActionLabel, onClick = { haptics.performHapticFeedback(HapticFeedbackType.Confirm) action.onClick() Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/NavBarPill.kt +21 −2 Original line number Diff line number Diff line Loading @@ -208,6 +208,9 @@ fun NavBarPill( ) { val closeButtonSize = 28.dp val closeButtonTouchTargetSize = 36.dp val filteredActions = FilterUtils.filterActions(actions) val expandActionLabel = stringResource(id = R.string.ambient_cue_expand_action) Spacer(modifier = Modifier.size(closeButtonTouchTargetSize)) Box { Loading @@ -223,13 +226,29 @@ fun NavBarPill( cornerRadius = 16.dp, visible = visible, ) .then(if (expanded) Modifier else Modifier.clickable { onClick() }) .then( if (expanded) Modifier else Modifier.clickable( // Set expand action when the action is not one-tap action. onClickLabel = if ( filteredActions.size == 1 && filteredActions[0].actionType == ActionType.MA && filteredActions[0].oneTapEnabled ) null else expandActionLabel ) { onClick() } ) .padding(2.dp) .onGloballyPositioned { expandedSize = it.size }, ) { // Should have at most 1 expanded chip var expandedChip = false val filteredActions = FilterUtils.filterActions(actions) filteredActions.fastForEachIndexed { index, action -> val isMrAction = action.actionType == ActionType.MR Loading
packages/SystemUI/compose/features/src/com/android/systemui/ambientcue/ui/compose/ShortPill.kt +11 −0 Original line number Diff line number Diff line Loading @@ -201,6 +201,7 @@ fun ShortPill( .padding(4.dp) val filteredActions = FilterUtils.filterActions(actions) val expandActionLabel = stringResource(id = R.string.ambient_cue_expand_action) // The layout for the un-expanded state (pill + side button) if (horizontal) { Loading @@ -222,6 +223,16 @@ fun ShortPill( Modifier.clickable( indication = null, interactionSource = null, // Set expand action when the action is not one-tap action. onClickLabel = if ( filteredActions.size == 1 && filteredActions[0].actionType == ActionType.MA && filteredActions[0].oneTapEnabled ) null else expandActionLabel, ) { onClick() } Loading
packages/SystemUI/res/values/strings.xml +6 −0 Original line number Diff line number Diff line Loading @@ -4465,4 +4465,10 @@ <!-- Content description for arrow in Pager Dots to navigate to next page [CHAR LIMIT=NONE] --> <string name="pager_dots_next_content_description">Next</string> <!-- Description for the Ambient Cue accessibility action label for autofilling. [CHAR LIMIT=NONE] --> <string name="ambient_cue_autofill_action">autofill</string> <!-- Description for the Ambient Cue accessibility action label for expanding. [CHAR LIMIT=NONE] --> <string name="ambient_cue_expand_action">expand</string> </resources>