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

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

Merge "[Flexiglass] Correct NSSL#drawBounds for the horizontal padding of the NSSL" into main

parents c0db678e b8bd6954
Loading
Loading
Loading
Loading
+2 −4
Original line number Diff line number Diff line
@@ -262,8 +262,7 @@ fun ContentScope.ConstrainedNotificationStack(
                .onSizeChanged { viewModel.onConstrainedAvailableSpaceChanged(it.height) }
                .onGloballyPositioned {
                    if (shouldUseLockscreenStackBounds(layoutState.transitionState)) {
                        // TODO(417965077) correct drawBounds for the horizontal padding of the NSSL
                        stackScrollView.setDrawBounds(it.boundsInWindow().toAndroidRectF())
                        stackScrollView.updateDrawBounds(it.boundsInWindow().toAndroidRectF())
                    }
                }
    ) {
@@ -634,8 +633,7 @@ fun ContentScope.NotificationScrollingStack(
                    )
                    .onGloballyPositioned {
                        if (!shouldUseLockscreenStackBounds(layoutState.transitionState)) {
                            // TODO(417965077) correct for the horizontal padding of the NSSL
                            stackScrollView.setDrawBounds(it.boundsInWindow().toAndroidRectF())
                            stackScrollView.updateDrawBounds(it.boundsInWindow().toAndroidRectF())
                        }
                    }
                    .debugBackground(viewModel, DEBUG_BOX_COLOR)
+1 −1
Original line number Diff line number Diff line
@@ -94,7 +94,7 @@ constructor(
                notificationStackScrolLView.get().apply {
                    // use -headsUpInset to allow HUN translation outside bounds for snoozing
                    setStackTop(-headsUpInset)
                    setDrawBounds(RectF())
                    updateDrawBounds(RectF())
                }
            }
        }
+5 −5
Original line number Diff line number Diff line
@@ -369,7 +369,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {

        // WHEN stackBottom changes
        final float newStackBottom = 800;
        mStackScroller.setDrawBounds(new RectF(0, stackTop, 400, newStackBottom));
        mStackScroller.updateDrawBounds(new RectF(0, stackTop, 400, newStackBottom));

        // THEN stackEndHeight is updated
        final float newStackHeight = newStackBottom - stackTop;
@@ -467,7 +467,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
        float stackHeight = stackBottom - stackTop;
        float stackWidth = 400;
        mStackScroller.setStackTop(stackTop);
        mStackScroller.setDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));
        mStackScroller.updateDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));

        // When: panel is expanding
        mStackScroller.setExpandFraction(expandFraction);
@@ -496,7 +496,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
        float stackHeight = stackBottom - stackTop;
        float stackWidth = 400;
        mStackScroller.setStackTop(stackTop);
        mStackScroller.setDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));
        mStackScroller.updateDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));

        // When: panel is fully expanded
        mStackScroller.setExpandFraction(expandFraction);
@@ -1059,7 +1059,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
        float stackWidth = 400;
        float stackViewPortHeight = stackBottom - stackTop;
        mStackScroller.setStackTop(stackTop);
        mStackScroller.setDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));
        mStackScroller.updateDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));
        when(mStackSizeCalculator.computeHeight(
                eq(mStackScroller),
                eq(-1),
@@ -1097,7 +1097,7 @@ public class NotificationStackScrollLayoutTest extends SysuiTestCase {
        float stackBottom = 1100;
        float stackWidth = 400;
        mStackScroller.setStackTop(stackTop);
        mStackScroller.setDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));
        mStackScroller.updateDrawBounds(new RectF(0, stackTop, stackWidth, stackBottom));

        // Given we have a limit on max displayed notifications
        int stackHeightBeforeUpdate = 100;
+4 −1
Original line number Diff line number Diff line
@@ -1296,8 +1296,11 @@ public class NotificationStackScrollLayout
    }

    @Override
    public void setDrawBounds(@NotNull RectF drawBounds) {
    public void updateDrawBounds(@NotNull RectF drawBounds) {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
        // The received drawBounds are relative to the Window, but NSSL  expects a rect relative to
        // its own position, so we need to offset it in case the NSSL has some horizontal margins.
        drawBounds.offset(-getX(), 0f);
        if (mAmbientState.getDrawBounds() != drawBounds) {
            mAmbientState.setDrawBounds(drawBounds);
            updateStackEndHeightAndStackHeight(mAmbientState.getExpansionFraction());
+1 −1
Original line number Diff line number Diff line
@@ -78,7 +78,7 @@ interface NotificationScrollView {
    fun setStackTop(stackTop: Float)

    /** set the area where this can place its content */
    fun setDrawBounds(bounds: RectF)
    fun updateDrawBounds(boundsInWindow: RectF)

    /** set the y position in px of the top of the HUN in this view's coordinates */
    fun setHeadsUpTop(headsUpTop: Float)