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

Commit 10d83fd6 authored by Danny Baumann's avatar Danny Baumann
Browse files

Close notification panel when swiping away the last clearable

notification.

Change-Id: I4e5114f66e799a7c80e18b38abce5678da460846
parent 4d0af804
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -19,5 +19,6 @@
    <item type="id" name="expandable_tag" />
    <item type="id" name="user_expanded_tag" />
    <item type="id" name="user_lock_tag" />
    <item type="id" name="user_cleared_tag" />
    <item type="id" name="status_bar_cling_stub" />
</resources>
+7 −3
Original line number Diff line number Diff line
@@ -257,6 +257,10 @@ public class SwipeHelper implements Gefingerpoken {
     * @param velocity The desired pixels/second speed at which the view should move
     */
    public void dismissChild(final View view, float velocity) {
        dismissChild(view, velocity, false);
    }

    private void dismissChild(final View view, float velocity, final boolean fromUser) {
        final View animView = mCallback.getChildContentView(view);
        final boolean canAnimViewBeDismissed = mCallback.canChildBeDismissed(view);
        float newPos;
@@ -284,7 +288,7 @@ public class SwipeHelper implements Gefingerpoken {
        anim.setDuration(duration);
        anim.addListener(new AnimatorListenerAdapter() {
            public void onAnimationEnd(Animator animation) {
                mCallback.onChildDismissed(view);
                mCallback.onChildDismissed(view, fromUser);
                animView.setLayerType(View.LAYER_TYPE_NONE, null);
            }
        });
@@ -374,7 +378,7 @@ public class SwipeHelper implements Gefingerpoken {

                    if (dismissChild) {
                        // flingadingy
                        dismissChild(mCurrView, childSwipedFastEnough ? velocity : 0f);
                        dismissChild(mCurrView, childSwipedFastEnough ? velocity : 0f, true);
                    } else {
                        // snappity
                        mCallback.onDragCancelled(mCurrView);
@@ -395,7 +399,7 @@ public class SwipeHelper implements Gefingerpoken {

        void onBeginDrag(View v);

        void onChildDismissed(View v);
        void onChildDismissed(View v, boolean fromUser);

        void onDragCancelled(View v);
    }
+1 −1
Original line number Diff line number Diff line
@@ -212,7 +212,7 @@ public class RecentsHorizontalScrollView extends HorizontalScrollView
        mSwipeHelper.dismissChild(v, 0);
    }

    public void onChildDismissed(View v) {
    public void onChildDismissed(View v, boolean fromUser) {
        addToRecycledViews(v);
        mLinearLayout.removeView(v);
        mCallback.handleSwipe(v);
+1 −1
Original line number Diff line number Diff line
@@ -220,7 +220,7 @@ public class RecentsVerticalScrollView extends ScrollView
        mSwipeHelper.dismissChild(v, 0);
    }

    public void onChildDismissed(View v) {
    public void onChildDismissed(View v, boolean fromUser) {
        addToRecycledViews(v);
        mLinearLayout.removeView(v);
        mCallback.handleSwipe(v);
+10 −0
Original line number Diff line number Diff line
@@ -942,6 +942,16 @@ public abstract class BaseStatusBar extends SystemUI implements
        updateExpansionStates();
        updateNotificationIcons();

        if (entry.userCleared() && !mNotificationData.hasClearableItems()) {
            // wait a bit to make the user aware of what's happening
            mHandler.postDelayed(new Runnable() {
                @Override
                public void run() {
                    animateCollapsePanels(CommandQueue.FLAG_EXCLUDE_NONE);
                }
            }, 100);
        }

        return entry.notification;
    }

Loading