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

Commit 8c1072d7 authored by Olivier St-Onge's avatar Olivier St-Onge
Browse files

Remove the interaction when cancelled

This caused a bug in QS where the ripple effect would not get cleared after pressing and dragging away before releasing

Test: manually
Flag: EXEMPT bugfix
Fixes: 380861756
Change-Id: I816dd04797927e31698d04d63ca6ab3ee9251f4c
parent 42261925
Loading
Loading
Loading
Loading
+17 −17
Original line number Diff line number Diff line
@@ -77,9 +77,9 @@ import androidx.compose.ui.unit.Dp
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp
import androidx.compose.ui.zIndex
import com.android.app.tracing.coroutines.launchTraced as launch
import com.android.compose.modifiers.thenIf
import com.android.systemui.keyboard.shortcut.ui.model.IconSource
import com.android.app.tracing.coroutines.launchTraced as launch

/**
 * A selectable surface with no default focus/hover indications.
@@ -235,7 +235,8 @@ fun ShortcutHelperButton(
        color = color.getDimmedColorIfDisabled(enabled),
        border = border,
        modifier = modifier.semantics { role = Role.Button },
        interactionsConfig = InteractionsConfig(
        interactionsConfig =
            InteractionsConfig(
                hoverOverlayColor = MaterialTheme.colorScheme.onSurface,
                hoverOverlayAlpha = 0.11f,
                pressedOverlayColor = MaterialTheme.colorScheme.onSurface,
@@ -246,7 +247,7 @@ fun ShortcutHelperButton(
                surfaceCornerRadius = 28.dp,
                focusOutlineCornerRadius = 33.dp,
            ),
        enabled = enabled
        enabled = enabled,
    ) {
        Row(
            modifier =
@@ -267,7 +268,7 @@ private fun ShortcutHelperButtonContent(
    iconSource: IconSource,
    contentColor: Color,
    text: String?,
    contentDescription: String?
    contentDescription: String?,
) {
    if (iconSource.imageVector != null) {
        Icon(
@@ -278,8 +279,7 @@ private fun ShortcutHelperButtonContent(
        )
    }

    if (iconSource.imageVector != null && text != null)
        Spacer(modifier = Modifier.width(8.dp))
    if (iconSource.imageVector != null && text != null) Spacer(modifier = Modifier.width(8.dp))

    if (text != null) {
        Text(
@@ -363,7 +363,7 @@ private class ShortcutHelperInteractionsNode(
                    is HoverInteraction.Exit -> hoverInteractions.remove(interaction.enter)
                    is PressInteraction.Press -> pressInteractions.add(interaction)
                    is PressInteraction.Release -> pressInteractions.remove(interaction.press)
                    is PressInteraction.Cancel -> pressInteractions.add(interaction.press)
                    is PressInteraction.Cancel -> pressInteractions.remove(interaction.press)
                }
                isHovered.value = hoverInteractions.isNotEmpty()
                isPressed.value = pressInteractions.isNotEmpty()