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

Commit 6879bcb0 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Automerger Merge Worker
Browse files

Merge "Fix notification snooze a11y issues" into rvc-dev am: 25a39c2b

Change-Id: Ic3ff5c23a7bb2fd1b6890cc0f96022e4b7444855
parents c1ba125d 25a39c2b
Loading
Loading
Loading
Loading
+2 −1
Original line number Diff line number Diff line
@@ -20,7 +20,6 @@
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:orientation="vertical"
    android:clickable="true"
    android:background="@color/notification_material_background_color"
    android:theme="@style/Theme.SystemUI">

@@ -55,6 +54,8 @@
            android:layout_marginEnd="@dimen/notification_guts_button_side_margin"
            android:layout_alignParentEnd="true"
            android:layout_centerVertical="true"
            android:minWidth="@dimen/min_clickable_item_size"
            android:minHeight="@dimen/min_clickable_item_size"
            android:text="@string/snooze_undo"
            style="@style/TextAppearance.NotificationInfo.Button" />
    </RelativeLayout>
+3 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@
*/
-->
<resources>
    <!-- Recommended minimum clickable element dimension -->
    <dimen name="min_clickable_item_size">48dp</dimen>

    <!-- Amount to offset bottom of notification peek window from top of status bar. -->
    <dimen name="peek_window_y_offset">-12dp</dimen>

+1 −3
Original line number Diff line number Diff line
@@ -3001,9 +3001,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
            default:
                if (action == R.id.action_snooze) {
                    NotificationMenuRowPlugin provider = getProvider();
                    if (provider == null && mMenuRow != null) {
                        provider = createMenu();
                    } else {
                    if (provider == null) {
                        return false;
                    }
                    MenuItem snoozeMenu = provider.getSnoozeMenuItem(getContext());
+14 −12
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ public class NotificationSnooze extends LinearLayout
    private NotificationSwipeActionHelper mSnoozeListener;
    private StatusBarNotification mSbn;

    private View mSnoozeView;
    private TextView mSelectedOptionText;
    private TextView mUndoButton;
    private ImageView mExpandButton;
@@ -122,7 +123,8 @@ public class NotificationSnooze extends LinearLayout
    protected void onFinishInflate() {
        super.onFinishInflate();
        mCollapsedHeight = getResources().getDimensionPixelSize(R.dimen.snooze_snackbar_min_height);
        findViewById(R.id.notification_snooze).setOnClickListener(this);
        mSnoozeView = findViewById(R.id.notification_snooze);
        mSnoozeView.setOnClickListener(this);
        mSelectedOptionText = (TextView) findViewById(R.id.snooze_option_default);
        mUndoButton = (TextView) findViewById(R.id.undo);
        mUndoButton.setOnClickListener(this);
@@ -146,16 +148,6 @@ public class NotificationSnooze extends LinearLayout
        logOptionSelection(MetricsEvent.NOTIFICATION_SNOOZE_CLICKED, mDefaultOption);
    }

    @Override
    public void onInitializeAccessibilityEvent(AccessibilityEvent event) {
        super.onInitializeAccessibilityEvent(event);
        if (mGutsContainer != null && mGutsContainer.isExposed()) {
            if (event.getEventType() == AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED) {
                event.getText().add(mSelectedOptionText.getText());
            }
        }
    }

    @Override
    public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
        super.onInitializeAccessibilityNodeInfo(info);
@@ -341,12 +333,22 @@ public class NotificationSnooze extends LinearLayout
        mSelectedOptionText.setText(option.getConfirmation());
        showSnoozeOptions(false);
        hideSelectedOption();
        sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
        if (userAction) {
            mSnoozeView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
            logOptionSelection(MetricsEvent.NOTIFICATION_SELECT_SNOOZE, option);
        }
    }

    @Override
    public boolean requestAccessibilityFocus() {
        if (mExpanded) {
            return super.requestAccessibilityFocus();
        } else {
            mSnoozeView.requestAccessibilityFocus();
            return false;
        }
    }

    private void logOptionSelection(int category, SnoozeOption option) {
        int index = mSnoozeOptions.indexOf(option);
        long duration = TimeUnit.MINUTES.toMillis(option.getMinutesToSnoozeFor());