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

Commit 85ccbbc3 authored by yoshiki iguchi's avatar yoshiki iguchi
Browse files

Move performDismiss utility method to ExpandableNotificationRow

This patch moves NotificationStackScrollLayout#performDismiss to
ExpandableNotificationRow class.

This is a clean-up and doesn't change any behavior.

Bug: none
Test: built and ran 'runtest systemui'

Change-Id: Ia4aa110ef787e12e7647ac6a674a5b4f6f26368e
parent d6808dc0
Loading
Loading
Loading
Loading
+14 −5
Original line number Diff line number Diff line
@@ -1091,11 +1091,21 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        return mGroupParentWhenDismissed;
    }

    public void performDismiss() {
    public void performDismiss(boolean fromAccessibility) {
        if (mGroupManager.isOnlyChildInGroup(getStatusBarNotification())) {
            ExpandableNotificationRow groupSummary =
                    mGroupManager.getLogicalGroupSummary(getStatusBarNotification());
            if (groupSummary.isClearable()) {
                groupSummary.performDismiss(fromAccessibility);
            }
        }
        setDismissed(true, fromAccessibility);
        if (isClearable()) {
            if (mOnDismissRunnable != null) {
                mOnDismissRunnable.run();
            }
        }
    }

    public void setOnDismissRunnable(Runnable onDismissRunnable) {
        mOnDismissRunnable = onDismissRunnable;
@@ -2313,8 +2323,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
        }
        switch (action) {
            case AccessibilityNodeInfo.ACTION_DISMISS:
                NotificationStackScrollLayout.performDismiss(this, mGroupManager,
                        true /* fromAccessibility */);
                performDismiss(true /* fromAccessibility */);
                return true;
            case AccessibilityNodeInfo.ACTION_COLLAPSE:
            case AccessibilityNodeInfo.ACTION_EXPAND:
+3 −21
Original line number Diff line number Diff line
@@ -951,7 +951,9 @@ public class NotificationStackScrollLayout extends ViewGroup
                mHeadsUpManager.addSwipedOutNotification(row.getStatusBarNotification().getKey());
            }
        }
        performDismiss(v, mGroupManager, false /* fromAccessibility */);
        if (v instanceof ExpandableNotificationRow) {
            ((ExpandableNotificationRow) v).performDismiss(false /* fromAccessibility */);
        }

        mFalsingManager.onNotificationDismissed();
        if (mFalsingManager.shouldEnforceBouncer()) {
@@ -960,26 +962,6 @@ public class NotificationStackScrollLayout extends ViewGroup
        }
    }

    public static void performDismiss(View v, NotificationGroupManager groupManager,
            boolean fromAccessibility) {
        if (!(v instanceof ExpandableNotificationRow)) {
            return;
        }
        ExpandableNotificationRow row = (ExpandableNotificationRow) v;
        if (groupManager.isOnlyChildInGroup(row.getStatusBarNotification())) {
            ExpandableNotificationRow groupSummary =
                    groupManager.getLogicalGroupSummary(row.getStatusBarNotification());
            if (groupSummary.isClearable()) {
                performDismiss(groupSummary, groupManager, fromAccessibility);
            }
        }
        row.setDismissed(true, fromAccessibility);
        if (row.isClearable()) {
            row.performDismiss();
        }
        if (DEBUG) Log.v(TAG, "onChildDismissed: " + v);
    }

    @Override
    public void onChildSnappedBack(View animView, float targetLeft) {
        mAmbientState.onDragFinished(animView);