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

Commit 70efd109 authored by Darrell Shi's avatar Darrell Shi
Browse files

Do not consume motion events in the highlighted item

The highlighted item, visually an outline, that highlights a content in
the communal hub grid, is drawn on top of the content itself, consuming
motion events, causing side effects like the configuration button not
triggering. This changes makes it so that the highlighted item does not
consume any motion event but pass them down to the content.

Bug: 330426036
Fix: 330426036
Test: verified tapping the widget configuration button works
Flag: ACONFIG com.android.systemui.communal_hub TEAMFOOD
Change-Id: I51cb5762219342ec46a4f5a0e41564582e95d4d0
parent 82101eb4
Loading
Loading
Loading
Loading
+8 −1
Original line number Diff line number Diff line
@@ -34,10 +34,12 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.runtime.rememberCoroutineScope
import androidx.compose.runtime.setValue
import androidx.compose.ui.ExperimentalComposeUiApi
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.input.pointer.pointerInput
import androidx.compose.ui.input.pointer.pointerInteropFilter
import androidx.compose.ui.unit.IntOffset
import androidx.compose.ui.unit.toOffset
import androidx.compose.ui.unit.toSize
@@ -235,6 +237,7 @@ fun Modifier.dragContainer(
}

/** Wrap LazyGrid item with additional modifier needed for drag and drop. */
@OptIn(ExperimentalComposeUiApi::class)
@ExperimentalFoundationApi
@Composable
fun LazyGridItemScope.DraggableItem(
@@ -269,7 +272,11 @@ fun LazyGridItemScope.DraggableItem(
    Box(modifier) {
        Box(draggingModifier) { content(dragging) }
        AnimatedVisibility(
            modifier = Modifier.matchParentSize(),
            modifier =
                Modifier.matchParentSize()
                    // Do not consume motion events in the highlighted item and pass them down to
                    // the content.
                    .pointerInteropFilter { false },
            visible = (dragging || selected) && !dragDropState.isDraggingToRemove,
            enter = fadeIn(),
            exit = fadeOut()