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

Commit 79e39e8e authored by Lyn Han's avatar Lyn Han Committed by Android (Google) Code Review
Browse files

Merge "Limit notification scroll up to status bar" into sc-dev

parents 98c0d3c8 3b434739
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ public class AmbientState {
    private int mExpandAnimationTopChange;
    private ExpandableNotificationRow mExpandingNotification;
    private float mHideAmount;
    private float mNotificationScrimTop;
    private boolean mAppearing;
    private float mPulseHeight = MAX_PULSE_HEIGHT;
    private float mDozeAmount = 0.0f;
@@ -255,6 +256,20 @@ public class AmbientState {
        return mHideAmount;
    }

    /**
     * Set y position of top of notifications background scrim, relative to top of screen.
     */
    public void setNotificationScrimTop(float notificationScrimTop) {
        mNotificationScrimTop = notificationScrimTop;
    }

    /**
     * @return Y position of top of notifications background scrim, relative to top of screen.
     */
    public float getNotificationScrimTop() {
        return mNotificationScrimTop;
    }

    public void setHideSensitive(boolean hideSensitive) {
        mHideSensitive = hideSensitive;
    }
+3 −4
Original line number Diff line number Diff line
@@ -1008,9 +1008,7 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable

    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    private void updateClippingToTopRoundedCorner() {
        Float clipStart = (float) mTopPadding
                + mStackTranslation
                + mAmbientState.getExpandAnimationTopChange();
        Float clipStart = mAmbientState.getNotificationScrimTop();
        Float clipEnd = clipStart + mCornerRadius;
        boolean first = true;
        for (int i = 0; i < getChildCount(); i++) {
@@ -1023,7 +1021,8 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
            boolean clip = clipStart > start && clipStart < end
                    || clipEnd >= start && clipEnd <= end;
            clip &= !(first && mScrollAdapter.isScrolledToTop());
            child.setDistanceToTopRoundness(ExpandableView.NO_ROUNDNESS);
            child.setDistanceToTopRoundness(clip ? Math.max(start - clipStart, 0)
                    : ExpandableView.NO_ROUNDNESS);
            first = false;
        }
    }
+3 −3
Original line number Diff line number Diff line
@@ -156,9 +156,9 @@ public class StackScrollAlgorithm {

    private void updateClipping(StackScrollAlgorithmState algorithmState,
            AmbientState ambientState) {
        float drawStart = !ambientState.isOnKeyguard()
                ? ambientState.getStackY() - ambientState.getScrollY() : 0;
        float clipStart = 0;
        float drawStart = ambientState.isOnKeyguard() ? 0
                : ambientState.getStackY() - ambientState.getScrollY();
        float clipStart = ambientState.getNotificationScrimTop();
        int childCount = algorithmState.visibleChildren.size();
        boolean firstHeadsUp = true;
        for (int i = 0; i < childCount; i++) {
+7 −3
Original line number Diff line number Diff line
@@ -331,7 +331,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private LockIconViewController mLockIconViewController;
    private NotificationsQuickSettingsContainer mNotificationContainerParent;
    private boolean mAnimateNextPositionUpdate;

    private float mQuickQsOffsetHeight;
    private int mTrackingPointer;
    private VelocityTracker mQsVelocityTracker;
    private boolean mQsTracking;
@@ -943,6 +943,8 @@ public class NotificationPanelViewController extends PanelViewController {
    }

    public void updateResources() {
        mQuickQsOffsetHeight = mResources.getDimensionPixelSize(
                com.android.internal.R.dimen.quick_qs_offset_height);
        mSplitShadeNotificationsTopPadding =
                mResources.getDimensionPixelSize(R.dimen.notifications_top_padding_split_shade);
        int qsWidth = mResources.getDimensionPixelSize(R.dimen.qs_panel_width);
@@ -2170,7 +2172,8 @@ public class NotificationPanelViewController extends PanelViewController {
                // can be wrong during transitions when waiting for the keyguard to unlock
                top = mTransitionToFullShadeQSPosition;
            } else {
                float notificationTop = getQSEdgePosition();
                final float notificationTop = getQSEdgePosition();
                mAmbientState.setNotificationScrimTop(notificationTop);
                top = (int) (isOnKeyguard() ? Math.min(qsPanelBottomY, notificationTop)
                        : notificationTop);
            }
@@ -2252,7 +2255,8 @@ public class NotificationPanelViewController extends PanelViewController {

    private float getQSEdgePosition() {
        // TODO: replace StackY with unified calculation
        return mAmbientState.getStackY() - mAmbientState.getScrollY();
        return Math.max(mQuickQsOffsetHeight * mAmbientState.getExpansionFraction(),
                mAmbientState.getStackY() - mAmbientState.getScrollY());
    }

    private int calculateQsBottomPosition(float qsExpansionFraction) {