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

Commit 0dd5ae13 authored by Danny Burakov's avatar Danny Burakov Committed by Android (Google) Code Review
Browse files

Merge "[Dual Shade] Recompose the shade whenever the cutout location changes." into main

parents 2b93300d 97be7d5a
Loading
Loading
Loading
Loading
+4 −5
Original line number Diff line number Diff line
@@ -479,9 +479,8 @@ private fun CutoutAwareShadeHeader(
        check(measurables[1].size == 1)

        val screenWidth = constraints.maxWidth
        val cutoutWidthPx = cutoutWidth
        val height = max(cutoutHeight + (cutoutTop * 2), statusBarHeight.roundToPx())
        val childConstraints = Constraints.fixed((screenWidth - cutoutWidthPx) / 2, height)
        val childConstraints = Constraints.fixed((screenWidth - cutoutWidth) / 2, height)

        val startMeasurable = measurables[0][0]
        val endMeasurable = measurables[1][0]
@@ -498,11 +497,11 @@ private fun CutoutAwareShadeHeader(
                }
                CutoutLocation.CENTER -> {
                    startPlaceable.placeRelative(x = 0, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidthPx, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidth, y = 0)
                }
                CutoutLocation.LEFT -> {
                    startPlaceable.placeRelative(x = cutoutWidthPx, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidthPx, y = 0)
                    startPlaceable.placeRelative(x = cutoutWidth, y = 0)
                    endPlaceable.placeRelative(x = startPlaceable.width + cutoutWidth, y = 0)
                }
            }
        }
+2 −3
Original line number Diff line number Diff line
@@ -233,7 +233,7 @@ private fun ContentScope.SingleShade(
    modifier: Modifier = Modifier,
    shadeSession: SaveableSession,
) {
    val cutout = LocalDisplayCutout.current
    val cutoutLocation = LocalDisplayCutout.current().location
    val cutoutInsets = WindowInsets.Companion.displayCutout

    var maxNotifScrimTop by remember { mutableIntStateOf(0) }
@@ -258,8 +258,7 @@ private fun ContentScope.SingleShade(
    val shadeHorizontalPadding =
        dimensionResource(id = R.dimen.notification_panel_margin_horizontal)
    val shadeMeasurePolicy =
        remember(cutout, cutoutInsets) {
            val cutoutLocation = cutout().location
        remember(cutoutLocation, cutoutInsets) {
            SingleShadeMeasurePolicy(
                onNotificationsTopChanged = { maxNotifScrimTop = it },
                cutoutInsetsProvider = {