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

Commit a8d0fe0c authored by Mady Mellor's avatar Mady Mellor Committed by android-build-merger
Browse files

Merge "Fix dismiss all clipping for tablet / landscape" into nyc-dev

am: 50e439df

* commit '50e439df':
  Fix dismiss all clipping for tablet / landscape

Change-Id: I182a773a7ec30a5af1773e34d6ccad2682abfddb
parents 3213833d 50e439df
Loading
Loading
Loading
Loading
+13 −8
Original line number Diff line number Diff line
@@ -329,7 +329,7 @@ public class SwipeHelper implements Gefingerpoken {
     */
    public void dismissChild(final View view, float velocity, boolean useAccelerateInterpolator) {
        dismissChild(view, velocity, null /* endAction */, 0 /* delay */,
                useAccelerateInterpolator, 0 /* fixedDuration */);
                useAccelerateInterpolator, 0 /* fixedDuration */, false /* isDismissAll */);
    }

    /**
@@ -341,17 +341,22 @@ public class SwipeHelper implements Gefingerpoken {
     * @param fixedDuration If not 0, this exact duration will be taken
     */
    public void dismissChild(final View animView, float velocity, final Runnable endAction,
            long delay, boolean useAccelerateInterpolator, long fixedDuration) {
            long delay, boolean useAccelerateInterpolator, long fixedDuration,
            boolean isDismissAll) {
        final boolean canBeDismissed = mCallback.canChildBeDismissed(animView);
        float newPos;
        boolean isLayoutRtl = animView.getLayoutDirection() == View.LAYOUT_DIRECTION_RTL;

        if (velocity < 0
                || (velocity == 0 && getTranslation(animView) < 0)
        // if we use the Menu to dismiss an item in landscape, animate up
                || (velocity == 0 && getTranslation(animView) == 0 && mSwipeDirection == Y)
        boolean animateUpForMenu = velocity == 0 && (getTranslation(animView) == 0 || isDismissAll)
                && mSwipeDirection == Y;
        // if the language is rtl we prefer swiping to the left
                || (velocity == 0 && getTranslation(animView) == 0 && isLayoutRtl)) {
        boolean animateLeftForRtl = velocity == 0 && (getTranslation(animView) == 0 || isDismissAll)
                && isLayoutRtl;
        boolean animateLeft = velocity < 0
                || (velocity == 0 && getTranslation(animView) < 0 && !isDismissAll);

        if (animateLeft || animateLeftForRtl || animateUpForMenu) {
            newPos = -getSize(animView);
        } else {
            newPos = getSize(animView);
+5 −20
Original line number Diff line number Diff line
@@ -986,7 +986,8 @@ public class NotificationStackScrollLayout extends ViewGroup
    }

    public void dismissViewAnimated(View child, Runnable endRunnable, int delay, long duration) {
        mSwipeHelper.dismissChild(child, 0, endRunnable, delay, true, duration);
        mSwipeHelper.dismissChild(child, 0, endRunnable, delay, true, duration,
                true /* isDismissAll */);
    }

    public void snapViewIfNeeded(View child) {
@@ -3194,9 +3195,6 @@ public class NotificationStackScrollLayout extends ViewGroup
            disableClipOptimization();
        }
        handleDismissAllClipping();
        if (mCurrIconRow != null && mCurrIconRow.isVisible()) {
            mCurrIconRow.getNotificationParent().animateTranslateNotification(0 /* left target */);
        }
    }

    private void handleDismissAllClipping() {
@@ -3639,10 +3637,7 @@ public class NotificationStackScrollLayout extends ViewGroup
        @Override
        public Animator getViewTranslationAnimator(View v, float target,
                AnimatorUpdateListener listener) {
            if (mDismissAllInProgress) {
                // When dismissing all, we translate the entire view instead.
                return super.getViewTranslationAnimator(v, target, listener);
            } else if (v instanceof ExpandableNotificationRow) {
            if (v instanceof ExpandableNotificationRow) {
                return ((ExpandableNotificationRow) v).getTranslateViewAnimator(target, listener);
            } else {
                return super.getViewTranslationAnimator(v, target, listener);
@@ -3651,23 +3646,13 @@ public class NotificationStackScrollLayout extends ViewGroup

        @Override
        public void setTranslation(View v, float translate) {
            if (mDismissAllInProgress) {
                // When dismissing all, we translate the entire view instead.
                super.setTranslation(v, translate);
            } else {
            ((ExpandableView) v).setTranslation(translate);
        }
        }

        @Override
        public float getTranslation(View v) {
            if (mDismissAllInProgress) {
                // When dismissing all, we translate the entire view instead.
                return super.getTranslation(v);
            } else {
            return ((ExpandableView) v).getTranslation();
        }
        }

        public void closeControlsIfOutsideTouch(MotionEvent ev) {
            NotificationGuts guts = mPhoneStatusBar.getExposedGuts();