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

Commit 925b4b3d authored by Treehugger Robot's avatar Treehugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Adjust the behind glow position on 3-button mode." into main

parents 925112aa fe801fbd
Loading
Loading
Loading
Loading
+2 −2
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ fun ActionList(
    pillCenter: Offset = Offset.Unspecified,
    pillWidth: Float = 0f,
    rotation: Int = 0,
    inTaskBarOr3ButtonMode: Boolean = false,
    taskBarMode: Boolean = false,
) {
    val density = LocalDensity.current
    val minOverscrollDelta = (-8).dp
@@ -307,7 +307,7 @@ fun ActionList(
                }
                .drawBehind {
                    val sidePaddingPx =
                        if (inTaskBarOr3ButtonMode && portrait) {
                        if (taskBarMode) {
                            pillCenter.x - actionListCenterPositionX
                        } else {
                            with(density) { scrimHorizontalPadding.toPx() }
+9 −2
Original line number Diff line number Diff line
@@ -23,6 +23,7 @@ import androidx.compose.foundation.clickable
import androidx.compose.foundation.layout.Box
import androidx.compose.foundation.layout.PaddingValues
import androidx.compose.foundation.layout.padding
import androidx.compose.material3.windowsizeclass.WindowHeightSizeClass
import androidx.compose.material3.windowsizeclass.WindowWidthSizeClass
import androidx.compose.runtime.Composable
import androidx.compose.runtime.LaunchedEffect
@@ -140,6 +141,11 @@ private fun TaskBarAnd3ButtonAmbientCue(
    }
    val content = LocalContext.current
    val rotation = content.display.rotation
    val windowWidthSizeClass = calculateWindowSizeClass().widthSizeClass
    val windowHeightSizeClass = calculateWindowSizeClass().heightSizeClass
    val largeScreen =
        (windowWidthSizeClass != WindowWidthSizeClass.Compact &&
            windowHeightSizeClass != WindowHeightSizeClass.Compact)

    ActionList(
        actions = actions,
@@ -183,7 +189,7 @@ private fun TaskBarAnd3ButtonAmbientCue(
        pillCenter = pillCenter,
        pillWidth = pillSize.width,
        rotation = rotation,
        inTaskBarOr3ButtonMode = true,
        taskBarMode = largeScreen,
    )
    ShortPill(
        actions = actions,
@@ -191,6 +197,7 @@ private fun TaskBarAnd3ButtonAmbientCue(
        horizontal = portrait,
        expanded = expanded,
        rotation = rotation,
        taskBarMode = largeScreen,
        modifier =
            if (pillPositionInWindow == null) {
                modifier.padding(bottom = 12.dp, end = 24.dp).onGloballyPositioned {
@@ -291,4 +298,4 @@ 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 + 24
private const val ACTIONS_HORIZONTAL_PADDING = 32
private const val ACTIONS_TOP_PADDING = 32
private const val ACTIONS_TOP_PADDING = 42
+7 −5
Original line number Diff line number Diff line
@@ -90,6 +90,7 @@ fun ShortPill(
    visible: Boolean = true,
    expanded: Boolean = false,
    rotation: Int = 0,
    taskBarMode: Boolean = false,
    onClick: () -> Unit = {},
    onCloseClick: () -> Unit = {},
    onAnimationStateChange: (Int, AmbientCueAnimationState) -> Unit = { _, _ -> },
@@ -181,12 +182,13 @@ fun ShortPill(
                // SmartScrim
                val halfWidth = size.width / 2f
                val halfHeight = size.height / 2f
                val smartScrimRadius = 50.dp.toPx()
                if (!(halfWidth > 0) || !(halfHeight > 0)) return@drawBehind
                val scrimBrush =
                    Brush.radialGradient(
                        colors = listOf(scrimColor, scrimColor.copy(alpha = 0f)),
                        center = Offset.Zero,
                        radius = if (horizontal) halfWidth else halfHeight,
                        radius = if (horizontal) smartScrimRadius * 0.9f else halfHeight,
                    )
                translate(
                    left =
@@ -194,17 +196,17 @@ fun ShortPill(
                        else {
                            if (rotation == ROTATION_90) size.width else 0f
                        },
                    top = if (horizontal) size.height else halfHeight,
                    top = if (taskBarMode) size.height else halfHeight,
                ) {
                    scale(
                        scaleX = if (horizontal) 1f else 0.3f,
                        scaleY = if (horizontal) 0.3f else 1f,
                        scaleX = if (horizontal) 4.12f else 0.3f,
                        scaleY = 1f,
                        pivot = Offset.Zero,
                    ) {
                        drawCircle(
                            brush = scrimBrush,
                            alpha = smartScrimAlpha + smartScrimAlphaBoost,
                            radius = if (horizontal) halfWidth else halfHeight,
                            radius = if (horizontal) smartScrimRadius else halfHeight,
                            center = Offset.Zero,
                        )
                    }