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

Commit e907911e authored by Selim Cinek's avatar Selim Cinek
Browse files

Bye bye veto button

You were just overruled by the congress
of usefulness.
In other bad joke news: this also fixes a bug
where it was focusable.

Test: dismiss notification, observe it working
Change-Id: I6d170563d0c4371066ce7b149bc40053e41ca5e2
Fixes: 32127661
parent ae1bbbb3
Loading
Loading
Loading
Loading
+3 −10
Original line number Diff line number Diff line
@@ -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

+6 −13
Original line number Diff line number Diff line
@@ -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<View>();
@@ -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();