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

Commit 8f8445ce authored by Tianfan Zhang's avatar Tianfan Zhang
Browse files

Relocate the ActionList when in landscape mode.

Bug: 425470976
Flag: com.android.systemui.enable_underlay
Test: Manual test
Change-Id: Ie2df647170b52c2ab7427840c0ce393dd1ef1ba4
parent 92bc2cbf
Loading
Loading
Loading
Loading
+0 −2
Original line number Diff line number Diff line
@@ -95,7 +95,6 @@ fun ActionList(
    val minOverscrollDelta = (-8).dp
    val maxOverscrollDelta = 0.dp
    val columnSpacing = 8.dp
    val topPadding = 32.dp
    val minGradientHeight = 70.dp
    val edgeAligned = horizontalAlignment == Alignment.Start || horizontalAlignment == Alignment.End
    val smartScrimAlpha by
@@ -283,7 +282,6 @@ fun ActionList(
                        )
                    }
                }
                .padding(top = topPadding)
                .padding(padding),
        verticalArrangement = Arrangement.spacedBy(columnSpacing, Alignment.Bottom),
        horizontalAlignment = horizontalAlignment,
+22 −7
Original line number Diff line number Diff line
@@ -33,6 +33,7 @@ import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.geometry.Offset
import androidx.compose.ui.geometry.Rect
import androidx.compose.ui.geometry.Size
import androidx.compose.ui.graphics.graphicsLayer
import androidx.compose.ui.layout.boundsInParent
import androidx.compose.ui.layout.onGloballyPositioned
@@ -123,6 +124,7 @@ private fun TaskBarAnd3ButtonAmbientCue(
    val density = LocalDensity.current
    val portrait = configuration.orientation == Configuration.ORIENTATION_PORTRAIT
    var pillCenter by remember { mutableStateOf(Offset.Zero) }
    var pillSize by remember { mutableStateOf(Size(0)) }
    val screenWidthPx = with(density) { configuration.screenWidthDp.dp.toPx() }
    var touchableRegion by remember { mutableStateOf<Rect?>(null) }
    LaunchedEffect(expanded, touchableRegion) {
@@ -137,15 +139,25 @@ private fun TaskBarAnd3ButtonAmbientCue(
        showEducation = viewModel.showLongPressEducation,
        modifier =
            modifier.graphicsLayer {
                if (portrait) {
                    translationX = screenWidthPx - size.width
                    translationY = pillCenter.y - size.height
                } else {
                    translationX = screenWidthPx - pillSize.height - size.width
                    translationY = pillCenter.y - pillSize.width
                }
            },
        padding =
            if (portrait) {
                PaddingValues(
                    start = ACTIONS_HORIZONTAL_PADDING.dp,
                    end = ACTIONS_HORIZONTAL_PADDING.dp,
                    top = ACTIONS_TOP_PADDING.dp,
                    bottom = SHORT_PILL_ACTIONS_VERTICAL_PADDING.dp,
            ),
                )
            } else {
                PaddingValues()
            },
    )
    ShortPill(
        actions = actions,
@@ -161,6 +173,7 @@ private fun TaskBarAnd3ButtonAmbientCue(
                Modifier.graphicsLayer {
                        translationX = pillCenter.x - size.width / 2
                        translationY = pillCenter.y - size.height / 2
                        pillSize = size
                    }
                    .onGloballyPositioned { layoutCoordinates ->
                        layoutCoordinates.parentCoordinates?.let { parentCoordinates ->
@@ -211,6 +224,7 @@ private fun NavBarAmbientCue(
        modifier = modifier,
        padding =
            PaddingValues(
                top = ACTIONS_TOP_PADDING.dp,
                bottom = NAV_BAR_ACTIONS_PADDING.dp,
                start = ACTIONS_HORIZONTAL_PADDING.dp,
                end = ACTIONS_HORIZONTAL_PADDING.dp,
@@ -246,5 +260,6 @@ private const val NAV_BAR_HEIGHT_DP = 24 // R.dimen.taskbar_stashed_size from La
private const val SHORT_PILL_ACTIONS_VERTICAL_PADDING = 38
private const val NAV_BAR_ACTIONS_PADDING = NAV_BAR_HEIGHT_DP + 16
private const val ACTIONS_HORIZONTAL_PADDING = 32
private const val ACTIONS_TOP_PADDING = 32

private const val ONE_TAP_DELAY_MS = 500L