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

Commit fe801fbd authored by Tianfan Zhang's avatar Tianfan Zhang
Browse files

Adjust the behind glow position on 3-button mode.

Bug: 435604222
Flag: EXEMPT bugfix
Test: Manual
Change-Id: I45b743a8cc8ad45e6ff2ba4cc1325b9547af82c8
parent fe6783b8
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
@@ -308,7 +308,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
@@ -135,6 +136,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,
@@ -178,7 +184,7 @@ private fun TaskBarAnd3ButtonAmbientCue(
        pillCenter = pillCenter,
        pillWidth = pillSize.width,
        rotation = rotation,
        inTaskBarOr3ButtonMode = true,
        taskBarMode = largeScreen,
    )
    ShortPill(
        actions = actions,
@@ -186,6 +192,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 {
@@ -283,4 +290,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
@@ -89,6 +89,7 @@ fun ShortPill(
    visible: Boolean = true,
    expanded: Boolean = false,
    rotation: Int = 0,
    taskBarMode: Boolean = false,
    onClick: () -> Unit = {},
    onCloseClick: () -> Unit = {},
) {
@@ -163,12 +164,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 =
@@ -176,17 +178,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,
                        )
                    }