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

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

Merge "Fling shade open with overscroll"

parents 418ac0a7 195d1b15
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -78,6 +78,7 @@ public class AmbientState {
    private ExpandableNotificationRow mTrackedHeadsUpRow;
    private float mAppearFraction;
    private boolean mIsShadeOpening;
    private float mSectionPadding;

    /** Tracks the state from AlertingNotificationManager#hasNotifications() */
    private boolean mHasAlertEntries;
@@ -105,6 +106,14 @@ public class AmbientState {
        return mIsShadeOpening;
    }

    void setSectionPadding(float padding) {
        mSectionPadding = padding;
    }

    float getSectionPadding() {
        return mSectionPadding;
    }

    private static int getZDistanceBetweenElements(Context context) {
        return Math.max(1, context.getResources()
                .getDimensionPixelSize(R.dimen.z_distance_between_notifications));
+5 −0
Original line number Diff line number Diff line
@@ -554,6 +554,11 @@ public class NotificationStackScrollLayout extends ViewGroup implements Dumpable
        mAmbientState.setIsShadeOpening(isOpening);
    }

    void setSectionPadding(float margin) {
        mAmbientState.setSectionPadding(margin);
        requestChildrenUpdate();
    }

    @Override
    @ShadeViewRefactor(RefactorComponent.SHADE_VIEW)
    protected void onFinishInflate() {
+4 −0
Original line number Diff line number Diff line
@@ -275,6 +275,10 @@ public class NotificationStackScrollLayoutController {
        mView.setIsShadeOpening(isOpening);
    }

    public void setSectionPadding(float padding) {
        mView.setSectionPadding(padding);
    }

    private final OnMenuEventListener mMenuEventListener = new OnMenuEventListener() {
        @Override
        public void onMenuClicked(
+6 −1
Original line number Diff line number Diff line
@@ -341,7 +341,8 @@ public class StackScrollAlgorithm {
        boolean isEmptyShadeView = child instanceof EmptyShadeView;

        childViewState.location = ExpandableViewState.LOCATION_MAIN_AREA;
        float inset = ambientState.getTopPadding() + ambientState.getStackTranslation();
        float inset = ambientState.getTopPadding() + ambientState.getStackTranslation()
                + ambientState.getSectionPadding();
        if (i <= algorithmState.getIndexOfExpandingNotification()) {
            inset += ambientState.getExpandAnimationTopChange();
        }
@@ -563,6 +564,10 @@ public class StackScrollAlgorithm {
            childViewState.yTranslation = Math.max(childViewState.yTranslation, shelfStart);
        }
        childViewState.yTranslation = Math.min(childViewState.yTranslation, shelfStart);
        if (child instanceof SectionHeaderView) {
            // Add padding before sections for overscroll effect.
            childViewState.yTranslation += ambientState.getSectionPadding();
        }
        if (childViewState.yTranslation >= shelfStart) {
            childViewState.hidden = !child.isExpandAnimationRunning() && !child.hasExpandingChild();
            childViewState.inShelf = true;
+11 −18
Original line number Diff line number Diff line
@@ -477,6 +477,7 @@ public class NotificationPanelViewController extends PanelViewController {
    private boolean mShowingKeyguardHeadsUp;
    private boolean mAllowExpandForSmallExpansion;
    private Runnable mExpandAfterLayoutRunnable;
    private float mSectionPadding;

    /**
     * Is this a collapse that started on the panel where we should allow the panel to intercept
@@ -2415,6 +2416,16 @@ public class NotificationPanelViewController extends PanelViewController {
        mNotificationStackScrollLayoutController.setIsShadeOpening(isOpening);
    }

    @Override
    public void setSectionPadding(float padding) {
        if (padding == mSectionPadding) {
            return;
        }
        mSectionPadding = padding;
        mQsFrame.setTranslationY(padding);
        mNotificationStackScrollLayoutController.setSectionPadding(padding);
    }

    @Override
    protected void setOverExpansion(float overExpansion, boolean isPixels) {
        if (mConflictingQsExpansionGesture || mQsExpandImmediate) {
@@ -2501,19 +2512,6 @@ public class NotificationPanelViewController extends PanelViewController {
        }
    }

    @Override
    protected boolean shouldExpandToTopOfClearAll(float targetHeight) {
        boolean perform = super.shouldExpandToTopOfClearAll(targetHeight);
        if (!perform) {
            return false;
        }
        // Let's make sure we're not appearing but the animation will end below the appear.
        // Otherwise quick settings would jump at the end of the animation.
        float fraction = mNotificationStackScrollLayoutController
                .calculateAppearFraction(targetHeight);
        return fraction >= 1.0f;
    }

    @Override
    protected boolean shouldUseDismissingAnimation() {
        return mBarState != StatusBarState.SHADE && (mKeyguardStateController.canDismissLockScreen()
@@ -2532,11 +2530,6 @@ public class NotificationPanelViewController extends PanelViewController {
        return mNotificationStackScrollLayoutController.isFooterViewContentVisible();
    }

    @Override
    protected int getClearAllHeightWithPadding() {
        return mNotificationStackScrollLayoutController.getFooterViewHeightWithPadding();
    }

    @Override
    protected boolean isTrackingBlocked() {
        return mConflictingQsExpansionGesture && mQsExpanded || mBlockingExpansionForCurrentTouch;
Loading