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

Commit fb39ae32 authored by András Kurucz's avatar András Kurucz Committed by Android (Google) Code Review
Browse files

Merge "[Flexiglass] Update the y position of HUNs" into main

parents 3444ed7b 95fad256
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -145,6 +145,7 @@ fun SceneScope.HeadsUpNotificationSpace(
                    }
                    // Note: boundsInWindow doesn't scroll off the screen
                    stackScrollView.setHeadsUpTop(boundsInWindow.top)
                    stackScrollView.setHeadsUpBottom(boundsInWindow.bottom)
                }
    )
}
@@ -471,7 +472,11 @@ fun SceneScope.NotificationScrollingStack(
            )
        }
        if (shouldIncludeHeadsUpSpace) {
            HeadsUpNotificationSpace(stackScrollView = stackScrollView, viewModel = viewModel)
            HeadsUpNotificationSpace(
                stackScrollView = stackScrollView,
                viewModel = viewModel,
                modifier = Modifier.padding(top = topPadding)
            )
        }
    }
}
+1 −1
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ private fun SceneScope.QuickSettingsScene(
        HeadsUpNotificationSpace(
            stackScrollView = notificationStackScrollView,
            viewModel = notificationsPlaceholderViewModel,
            modifier = Modifier.align(Alignment.BottomCenter),
            modifier = Modifier.align(Alignment.BottomCenter).navigationBarsPadding(),
            isPeekFromBottom = true,
        )
        NotificationScrollingStack(
+29 −1
Original line number Diff line number Diff line
@@ -66,6 +66,8 @@ public class AmbientState implements Dumpable {
    private StatusBarKeyguardViewManager mStatusBarKeyguardViewManager;
    private float mStackTop;
    private float mStackCutoff;
    private float mHeadsUpTop;
    private float mHeadsUpBottom;
    private int mScrollY;
    private float mOverScrollTopAmount;
    private float mOverScrollBottomAmount;
@@ -377,6 +379,30 @@ public class AmbientState implements Dumpable {
        this.mStackCutoff = stackCutoff;
    }

    /** y coordinate of the top position of a pinned HUN */
    public float getHeadsUpTop() {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0f;
        return mHeadsUpTop;
    }

    /** @see #getHeadsUpTop() */
    public void setHeadsUpTop(float mHeadsUpTop) {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
        this.mHeadsUpTop = mHeadsUpTop;
    }

    /** the bottom-most y position where we can draw pinned HUNs  */
    public float getHeadsUpBottom() {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0f;
        return mHeadsUpBottom;
    }

    /** @see #getHeadsUpBottom() */
    public void setHeadsUpBottom(float headsUpBottom) {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
        mHeadsUpBottom = headsUpBottom;
    }

    public int getScrollY() {
        return mScrollY;
    }
@@ -784,7 +810,9 @@ public class AmbientState implements Dumpable {
    @Override
    public void dump(PrintWriter pw, String[] args) {
        pw.println("mStackTop=" + mStackTop);
        pw.println("mStackCutoff" + mStackCutoff);
        pw.println("mStackCutoff=" + mStackCutoff);
        pw.println("mHeadsUpTop=" + mHeadsUpTop);
        pw.println("mHeadsUpBottom=" + mHeadsUpBottom);
        pw.println("mTopPadding=" + mTopPadding);
        pw.println("mStackTopMargin=" + mStackTopMargin);
        pw.println("mStackTranslation=" + mStackTranslation);
+8 −2
Original line number Diff line number Diff line
@@ -834,7 +834,7 @@ public class NotificationStackScrollLayout
            y = (int) mAmbientState.getStackCutoff();
            drawDebugInfo(canvas, y, Color.MAGENTA, /* label= */ "getStackCutoff() = " + y);

            y = (int) mScrollViewFields.getHeadsUpTop();
            y = (int) mAmbientState.getHeadsUpTop();
            drawDebugInfo(canvas, y, Color.GREEN, /* label= */ "getHeadsUpTop() = " + y);

            y += getTopHeadsUpHeight();
@@ -1222,7 +1222,12 @@ public class NotificationStackScrollLayout

    @Override
    public void setHeadsUpTop(float headsUpTop) {
        mScrollViewFields.setHeadsUpTop(headsUpTop);
        mAmbientState.setHeadsUpTop(headsUpTop);
    }

    @Override
    public void setHeadsUpBottom(float headsUpBottom) {
        mAmbientState.setHeadsUpBottom(headsUpBottom);
    }

    @Override
@@ -4894,6 +4899,7 @@ public class NotificationStackScrollLayout
     * @param bottomBarHeight the height of the bar on the bottom
     */
    public void setHeadsUpBoundaries(int height, int bottomBarHeight) {
        SceneContainerFlag.assertInLegacyMode();
        mAmbientState.setMaxHeadsUpTranslation(height - bottomBarHeight);
        mStackScrollAlgorithm.setHeadsUpAppearHeightBottom(height);
        mStateAnimator.setHeadsUpAppearHeightBottom(height);
+0 −3
Original line number Diff line number Diff line
@@ -32,8 +32,6 @@ import java.util.function.Consumer
class ScrollViewFields {
    /** Used to produce the clipping path */
    var scrimClippingShape: ShadeScrimShape? = null
    /** Y coordinate in view pixels of the top of the HUN */
    var headsUpTop: Float = 0f
    /** Whether the notifications are scrolled all the way to the top (i.e. when freshly opened) */
    var isScrolledToTop: Boolean = true

@@ -74,7 +72,6 @@ class ScrollViewFields {
    fun dump(pw: IndentingPrintWriter) {
        pw.printSection("StackViewStates") {
            pw.println("scrimClippingShape", scrimClippingShape)
            pw.println("headsUpTop", headsUpTop)
            pw.println("isScrolledToTop", isScrolledToTop)
        }
    }
Loading