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

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

Merge "[Flexiglass] ScrollViewFields gardening" into main

parents 256cdd30 d188d1e5
Loading
Loading
Loading
Loading
+16 −17
Original line number Diff line number Diff line
@@ -645,7 +645,7 @@ public class NotificationStackScrollLayout
        @Override
        public boolean isScrolledToTop() {
            if (SceneContainerFlag.isEnabled()) {
                return mScrollViewFields.getScrollState().isScrolledToTop();
                return mScrollViewFields.scrollState.isScrolledToTop();
            } else {
                return getOwnScrollY() == 0;
            }
@@ -837,7 +837,7 @@ public class NotificationStackScrollLayout
            y = (int) mAmbientState.getHeadsUpTop();
            drawDebugInfo(canvas, y, Color.GREEN, /* label= */ "getHeadsUpTop() = " + y);

            y = (int) (mAmbientState.getStackTop() + mScrollViewFields.getIntrinsicStackHeight());
            y = (int) (mAmbientState.getStackTop() + mScrollViewFields.intrinsicStackHeight);
            drawDebugInfo(canvas, y, Color.BLUE,
                    /* label= */ "getStackTop() + getIntrinsicStackHeight() = " + y);

@@ -1253,9 +1253,9 @@ public class NotificationStackScrollLayout
        mForwardScrollable = forwardScrollable;
        mBackwardScrollable = backwardScrollable;

        boolean scrollPositionChanged = mScrollViewFields.getScrollState().getScrollPosition()
        boolean scrollPositionChanged = mScrollViewFields.scrollState.getScrollPosition()
                != scrollState.getScrollPosition();
        mScrollViewFields.setScrollState(scrollState);
        mScrollViewFields.scrollState = scrollState;

        if (scrollPositionChanged) {
            sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_SCROLLED);
@@ -1762,7 +1762,7 @@ public class NotificationStackScrollLayout
        if (mMaxDisplayedNotifications != -1) {
            // The stack intrinsic height already contains the correct value when there is a limit
            // in the max number of notifications (e.g. as in keyguard).
            height = mScrollViewFields.getIntrinsicStackHeight();
            height = mScrollViewFields.intrinsicStackHeight;
        } else {
            height = Math.max(0f, mAmbientState.getStackCutoff() - mAmbientState.getStackTop());
        }
@@ -2789,8 +2789,8 @@ public class NotificationStackScrollLayout
                shelfIntrinsicHeight,
                "updateIntrinsicStackHeight"
        );
        if (mScrollViewFields.getIntrinsicStackHeight() != notificationsHeight) {
            mScrollViewFields.setIntrinsicStackHeight(notificationsHeight);
        if (mScrollViewFields.intrinsicStackHeight != notificationsHeight) {
            mScrollViewFields.intrinsicStackHeight = notificationsHeight;
            notifyStackHeightChangedListeners();
        }
    }
@@ -2823,7 +2823,7 @@ public class NotificationStackScrollLayout
    @Override
    public int getIntrinsicStackHeight() {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return 0;
        return mScrollViewFields.getIntrinsicStackHeight();
        return mScrollViewFields.intrinsicStackHeight;
    }

    @Override
@@ -4132,7 +4132,7 @@ public class NotificationStackScrollLayout
        if (!SceneContainerFlag.isEnabled()) {
            return !isInsideQsHeader(ev);
        }
        ShadeScrimShape shape = mScrollViewFields.getClippingShape();
        ShadeScrimShape shape = mScrollViewFields.clippingShape;
        if (shape == null) {
            return true; // When there is no scrim, consider this event scrollable.
        }
@@ -5176,8 +5176,8 @@ public class NotificationStackScrollLayout
        event.setMaxScrollX(mScrollX);

        if (SceneContainerFlag.isEnabled()) {
            event.setScrollY(mScrollViewFields.getScrollState().getScrollPosition());
            event.setMaxScrollY(mScrollViewFields.getScrollState().getMaxScrollPosition());
            event.setScrollY(mScrollViewFields.scrollState.getScrollPosition());
            event.setMaxScrollY(mScrollViewFields.scrollState.getMaxScrollPosition());
        } else {
            event.setScrollY(getOwnScrollY());
            event.setMaxScrollY(getScrollRange());
@@ -6172,8 +6172,8 @@ public class NotificationStackScrollLayout
    @Override
    public void setClippingShape(@Nullable ShadeScrimShape shape) {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
        if (Objects.equals(mScrollViewFields.getClippingShape(), shape)) return;
        mScrollViewFields.setClippingShape(shape);
        if (Objects.equals(mScrollViewFields.clippingShape, shape)) return;
        mScrollViewFields.clippingShape = shape;
        mShouldUseRoundedRectClipping = shape != null;
        mRoundedClipPath.reset();
        if (shape != null) {
@@ -6200,9 +6200,8 @@ public class NotificationStackScrollLayout
    @Override
    public void setNegativeClippingShape(@Nullable ShadeScrimShape shape) {
        if (SceneContainerFlag.isUnexpectedlyInLegacyMode()) return;
        if (Objects.equals(mScrollViewFields.getNegativeClippingShape(), shape)) return;

        mScrollViewFields.setNegativeClippingShape(shape);
        if (Objects.equals(mScrollViewFields.negativeClippingShape, shape)) return;
        mScrollViewFields.negativeClippingShape = shape;
        mShouldUseNegativeRoundedRectClipping = shape != null;
        mNegativeRoundedClipPath.reset();
        if (shape != null) {
@@ -7129,7 +7128,7 @@ public class NotificationStackScrollLayout
    }

    /**
     * Use {@link ScrollViewFields#intrinsicStackHeight}, when SceneContainerFlag is enabled.
     * Use {@link ScrollViewFields#intrinsicStackHeight}}, when SceneContainerFlag is enabled.
     * @return the height of the content ignoring the footer.
     */
    public float getIntrinsicContentHeight() {
+8 −7
Original line number Diff line number Diff line
@@ -33,24 +33,24 @@ import java.util.function.Consumer
 */
class ScrollViewFields {
    /** Used to produce the clipping path */
    var clippingShape: ShadeScrimShape? = null
    @JvmField var clippingShape: ShadeScrimShape? = null

    /** Used to produce a negative clipping path */
    var negativeClippingShape: ShadeScrimShape? = null
    /** Used to produce the negative clipping path */
    @JvmField var negativeClippingShape: ShadeScrimShape? = null

    /** Scroll state of the notification shade. */
    var scrollState: ShadeScrollState = ShadeScrollState()
    @JvmField var scrollState: ShadeScrollState = ShadeScrollState()

    /**
     * Height in view pixels at which the Notification Stack would like to be laid out, including
     * Notification rows, paddings the Shelf and the Footer.
     * Notification rows, the Shelf, the Footer, or the EmptyView.
     */
    var intrinsicStackHeight: Int = 0
    @JvmField var intrinsicStackHeight: Int = 0

    /**
     * When internal NSSL expansion requires the stack to be scrolled (e.g. to keep an expanding
     * notification in view), that scroll amount can be sent here and it will be handled by the
     * placeholder
     * placeholder.
     */
    var syntheticScrollConsumer: Consumer<Float>? = null

@@ -104,6 +104,7 @@ class ScrollViewFields {
            pw.println("scrimClippingShape", clippingShape)
            pw.println("negativeClippingShape", negativeClippingShape)
            pw.println("scrollState", scrollState)
            pw.println("intrinsicStackHeight", intrinsicStackHeight)
        }
    }
}