Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 10f0f245 authored by Lucas Dupin's avatar Lucas Dupin Committed by Android (Google) Code Review
Browse files

Merge "Add custom click label for cuebar." into main

parents c02edcb7 bb1f5db7
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -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(
@@ -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()
+21 −2
Original line number Diff line number Diff line
@@ -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 {
@@ -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

+11 −0
Original line number Diff line number Diff line
@@ -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) {
@@ -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()
                                    }
+6 −0
Original line number Diff line number Diff line
@@ -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>