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

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

Merge "[Flexiglass] Deprecate NSSL.updateTopPadding" into main

parents 935f337d 6aa02884
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -511,10 +511,12 @@ public class AmbientState implements Dumpable {
    }
    }


    public int getTopPadding() {
    public int getTopPadding() {
        SceneContainerFlag.assertInLegacyMode();
        return mTopPadding;
        return mTopPadding;
    }
    }


    public void setTopPadding(int topPadding) {
    public void setTopPadding(int topPadding) {
        SceneContainerFlag.assertInLegacyMode();
        mTopPadding = topPadding;
        mTopPadding = topPadding;
    }
    }


+32 −24
Original line number Original line Diff line number Diff line
@@ -851,7 +851,7 @@ public class NotificationStackScrollLayout
            return; // the rest of the fields are not important in Flexiglass
            return; // the rest of the fields are not important in Flexiglass
        }
        }


        y = getTopPadding();
        y = mAmbientState.getTopPadding();
        drawDebugInfo(canvas, y, Color.RED, /* label= */ "getTopPadding() = " + y);
        drawDebugInfo(canvas, y, Color.RED, /* label= */ "getTopPadding() = " + y);


        y = getLayoutHeight();
        y = getLayoutHeight();
@@ -1231,9 +1231,11 @@ public class NotificationStackScrollLayout


    @Override
    @Override
    public void setStackTop(float stackTop) {
    public void setStackTop(float stackTop) {
        if (mAmbientState.getStackTop() != stackTop) {
            mAmbientState.setStackTop(stackTop);
            mAmbientState.setStackTop(stackTop);
        // TODO(b/332574413): replace the following with using stackTop
            onTopPaddingChanged(/* animate = */ isAddOrRemoveAnimationPending());
        updateTopPadding(stackTop, isAddOrRemoveAnimationPending());
            setExpandedHeight(mExpandedHeight);
        }
    }
    }


    @Override
    @Override
@@ -1386,12 +1388,15 @@ public class NotificationStackScrollLayout
    }
    }


    public int getTopPadding() {
    public int getTopPadding() {
        // TODO(b/332574413) replace all usages of getTopPadding()
        if (SceneContainerFlag.isEnabled()) {
            return (int) mAmbientState.getStackTop();
        } else {
            return mAmbientState.getTopPadding();
            return mAmbientState.getTopPadding();
        }
        }
    }


    private void setTopPadding(int topPadding, boolean animate) {
    private void onTopPaddingChanged(boolean animate) {
        if (getTopPadding() != topPadding) {
            mAmbientState.setTopPadding(topPadding);
        boolean shouldAnimate = animate || mAnimateNextTopPaddingChange;
        boolean shouldAnimate = animate || mAnimateNextTopPaddingChange;
        updateAlgorithmHeightAndPadding();
        updateAlgorithmHeightAndPadding();
        updateContentHeight();
        updateContentHeight();
@@ -1408,7 +1413,6 @@ public class NotificationStackScrollLayout
        notifyHeightChangeListener(null, shouldAnimate);
        notifyHeightChangeListener(null, shouldAnimate);
        mAnimateNextTopPaddingChange = false;
        mAnimateNextTopPaddingChange = false;
    }
    }
    }


    /**
    /**
     * Apply expansion fraction to the y position and height of the notifications panel.
     * Apply expansion fraction to the y position and height of the notifications panel.
@@ -2708,6 +2712,7 @@ public class NotificationStackScrollLayout
     * @param animate  whether to animate the change
     * @param animate  whether to animate the change
     */
     */
    public void updateTopPadding(float qsHeight, boolean animate) {
    public void updateTopPadding(float qsHeight, boolean animate) {
        SceneContainerFlag.assertInLegacyMode();
        int topPadding = (int) qsHeight;
        int topPadding = (int) qsHeight;
        int minStackHeight = getLayoutMinHeightInternal();
        int minStackHeight = getLayoutMinHeightInternal();
        if (topPadding + minStackHeight > getHeight()) {
        if (topPadding + minStackHeight > getHeight()) {
@@ -2715,7 +2720,10 @@ public class NotificationStackScrollLayout
        } else {
        } else {
            mTopPaddingOverflow = 0;
            mTopPaddingOverflow = 0;
        }
        }
        setTopPadding(topPadding, animate && !mKeyguardBypassEnabled);
        if (mAmbientState.getTopPadding() != topPadding) {
            mAmbientState.setTopPadding(topPadding);
            onTopPaddingChanged(/* animate = */ animate && !mKeyguardBypassEnabled);
        }
        setExpandedHeight(mExpandedHeight);
        setExpandedHeight(mExpandedHeight);
    }
    }


+1 −0
Original line number Original line Diff line number Diff line
@@ -1328,6 +1328,7 @@ public class NotificationStackScrollLayoutController implements Dumpable {
    }
    }


    public int getTopPadding() {
    public int getTopPadding() {
        SceneContainerFlag.assertInLegacyMode();
        return mView.getTopPadding();
        return mView.getTopPadding();
    }
    }