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

Commit 4fefeb0c authored by burakov's avatar burakov Committed by Danny Burakov
Browse files

[bc25] PlaceAllCopies of the shade overlay panel.

Bug: 356596436
Flag: com.android.systemui.scene_container
Flag: com.android.systemui.dual_shade
Test: Manually tested by expanding and collapsing the both shades.
Change-Id: Icf9701864d8f66d779bd806891c6c0c7e10d886c
parent 1f4ae033
Loading
Loading
Loading
Loading
+13 −17
Original line number Diff line number Diff line
@@ -61,23 +61,17 @@ fun SceneScope.OverlayShade(
    Box(modifier) {
        Scrim(onClicked = onScrimClicked)

        Box(
            modifier = Modifier.fillMaxSize().panelPadding(),
            contentAlignment = Alignment.TopEnd,
        ) {
        Box(modifier = Modifier.fillMaxSize().panelPadding(), contentAlignment = Alignment.TopEnd) {
            Panel(
                modifier = Modifier.element(OverlayShade.Elements.Panel).panelSize(),
                content = content
                content = content,
            )
        }
    }
}

@Composable
private fun SceneScope.Scrim(
    onClicked: () -> Unit,
    modifier: Modifier = Modifier,
) {
private fun SceneScope.Scrim(onClicked: () -> Unit, modifier: Modifier = Modifier) {
    Spacer(
        modifier =
            modifier
@@ -89,10 +83,7 @@ private fun SceneScope.Scrim(
}

@Composable
private fun SceneScope.Panel(
    modifier: Modifier = Modifier,
    content: @Composable () -> Unit,
) {
private fun SceneScope.Panel(modifier: Modifier = Modifier, content: @Composable () -> Unit) {
    Box(modifier = modifier.clip(OverlayShade.Shapes.RoundedCornerPanel)) {
        Spacer(
            modifier =
@@ -101,7 +92,7 @@ private fun SceneScope.Panel(
                    .background(
                        color = OverlayShade.Colors.PanelBackground,
                        shape = OverlayShade.Shapes.RoundedCornerPanel,
                    ),
                    )
        )

        // This content is intentionally rendered as a separate element from the background in order
@@ -137,7 +128,7 @@ private fun Modifier.panelPadding(): Modifier {
            systemBars.asPaddingValues(),
            displayCutout.asPaddingValues(),
            waterfall.asPaddingValues(),
            contentPadding
            contentPadding,
        )

    return if (widthSizeClass == WindowWidthSizeClass.Compact) {
@@ -156,14 +147,19 @@ private fun combinePaddings(vararg paddingValues: PaddingValues): PaddingValues
        start = paddingValues.maxOfOrNull { it.calculateStartPadding(layoutDirection) } ?: 0.dp,
        top = paddingValues.maxOfOrNull { it.calculateTopPadding() } ?: 0.dp,
        end = paddingValues.maxOfOrNull { it.calculateEndPadding(layoutDirection) } ?: 0.dp,
        bottom = paddingValues.maxOfOrNull { it.calculateBottomPadding() } ?: 0.dp
        bottom = paddingValues.maxOfOrNull { it.calculateBottomPadding() } ?: 0.dp,
    )
}

object OverlayShade {
    object Elements {
        val Scrim = ElementKey("OverlayShadeScrim", contentPicker = LowestZIndexContentPicker)
        val Panel = ElementKey("OverlayShadePanel", contentPicker = LowestZIndexContentPicker)
        val Panel =
            ElementKey(
                "OverlayShadePanel",
                contentPicker = LowestZIndexContentPicker,
                placeAllCopies = true,
            )
        val PanelBackground =
            ElementKey("OverlayShadePanelBackground", contentPicker = LowestZIndexContentPicker)
    }