diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index ab4ef2baf1c3c..edbcee033b103 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -979,15 +979,8 @@ public abstract class BaseStatusBar extends SystemUI implements } } - protected void bindDismissListener(final ExpandableNotificationRow row) { - row.setOnDismissListener(new View.OnClickListener() { - public void onClick(View v) { - // Accessibility feedback - v.announceForAccessibility( - mContext.getString(R.string.accessibility_notification_dismissed)); - performRemoveNotification(row.getStatusBarNotification()); - } - }); + protected void bindDismissRunnable(final ExpandableNotificationRow row) { + row.setOnDismissRunnable(() -> performRemoveNotification(row.getStatusBarNotification())); } protected void performRemoveNotification(StatusBarNotification n) { @@ -1653,7 +1646,7 @@ public abstract class BaseStatusBar extends SystemUI implements } workAroundBadLayerDrawableOpacity(row); - bindDismissListener(row); + bindDismissRunnable(row); // NB: the large icon is now handled entirely by the template diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java index 33f2d83f066a6..d1c0073ca1aee 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableNotificationRow.java @@ -113,7 +113,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private NotificationContentView mPrivateLayout; private int mMaxExpandHeight; private int mHeadsUpHeight; - private View mVetoButton; private int mNotificationColor; private ExpansionLogger mLogger; private String mLoggingKey; @@ -198,6 +197,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { private boolean mIconsVisible = true; private boolean mAboveShelf; private boolean mIsLastChild; + private Runnable mOnDismissRunnable; public boolean isGroupExpansionChanging() { if (isChildInGroup()) { @@ -813,11 +813,13 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { } public void performDismiss() { - mVetoButton.performClick(); + if (mOnDismissRunnable != null) { + mOnDismissRunnable.run(); + } } - public void setOnDismissListener(OnClickListener listener) { - mVetoButton.setOnClickListener(listener); + public void setOnDismissRunnable(Runnable onDismissRunnable) { + mOnDismissRunnable = onDismissRunnable; } public View getNotificationIcon() { @@ -1027,10 +1029,6 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mTranslateableViews.add(mChildrenContainer); } }); - mVetoButton = findViewById(R.id.veto); - mVetoButton.setImportantForAccessibility(View.IMPORTANT_FOR_ACCESSIBILITY_NO); - mVetoButton.setContentDescription(mContext.getString( - R.string.accessibility_remove_notification)); // Add the views that we translate to reveal the gear mTranslateableViews = new ArrayList(); @@ -1038,16 +1036,11 @@ public class ExpandableNotificationRow extends ActivatableNotificationView { mTranslateableViews.add(getChildAt(i)); } // Remove views that don't translate - mTranslateableViews.remove(mVetoButton); mTranslateableViews.remove(mSettingsIconRowStub); mTranslateableViews.remove(mChildrenContainerStub); mTranslateableViews.remove(mGutsStub); } - public View getVetoButton() { - return mVetoButton; - } - public void resetTranslation() { if (mTranslateAnim != null) { mTranslateAnim.cancel();