Merge "Fix notification snooze a11y issues" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
25a39c2b84
@@ -20,7 +20,6 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:clickable="true"
|
|
||||||
android:background="@color/notification_material_background_color"
|
android:background="@color/notification_material_background_color"
|
||||||
android:theme="@style/Theme.SystemUI">
|
android:theme="@style/Theme.SystemUI">
|
||||||
|
|
||||||
@@ -55,6 +54,8 @@
|
|||||||
android:layout_marginEnd="@dimen/notification_guts_button_side_margin"
|
android:layout_marginEnd="@dimen/notification_guts_button_side_margin"
|
||||||
android:layout_alignParentEnd="true"
|
android:layout_alignParentEnd="true"
|
||||||
android:layout_centerVertical="true"
|
android:layout_centerVertical="true"
|
||||||
|
android:minWidth="@dimen/min_clickable_item_size"
|
||||||
|
android:minHeight="@dimen/min_clickable_item_size"
|
||||||
android:text="@string/snooze_undo"
|
android:text="@string/snooze_undo"
|
||||||
style="@style/TextAppearance.NotificationInfo.Button" />
|
style="@style/TextAppearance.NotificationInfo.Button" />
|
||||||
</RelativeLayout>
|
</RelativeLayout>
|
||||||
|
|||||||
@@ -16,6 +16,9 @@
|
|||||||
*/
|
*/
|
||||||
-->
|
-->
|
||||||
<resources>
|
<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. -->
|
<!-- Amount to offset bottom of notification peek window from top of status bar. -->
|
||||||
<dimen name="peek_window_y_offset">-12dp</dimen>
|
<dimen name="peek_window_y_offset">-12dp</dimen>
|
||||||
|
|
||||||
|
|||||||
@@ -3001,9 +3001,7 @@ public class ExpandableNotificationRow extends ActivatableNotificationView
|
|||||||
default:
|
default:
|
||||||
if (action == R.id.action_snooze) {
|
if (action == R.id.action_snooze) {
|
||||||
NotificationMenuRowPlugin provider = getProvider();
|
NotificationMenuRowPlugin provider = getProvider();
|
||||||
if (provider == null && mMenuRow != null) {
|
if (provider == null) {
|
||||||
provider = createMenu();
|
|
||||||
} else {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
MenuItem snoozeMenu = provider.getSnoozeMenuItem(getContext());
|
MenuItem snoozeMenu = provider.getSnoozeMenuItem(getContext());
|
||||||
|
|||||||
@@ -79,6 +79,7 @@ public class NotificationSnooze extends LinearLayout
|
|||||||
private NotificationSwipeActionHelper mSnoozeListener;
|
private NotificationSwipeActionHelper mSnoozeListener;
|
||||||
private StatusBarNotification mSbn;
|
private StatusBarNotification mSbn;
|
||||||
|
|
||||||
|
private View mSnoozeView;
|
||||||
private TextView mSelectedOptionText;
|
private TextView mSelectedOptionText;
|
||||||
private TextView mUndoButton;
|
private TextView mUndoButton;
|
||||||
private ImageView mExpandButton;
|
private ImageView mExpandButton;
|
||||||
@@ -122,7 +123,8 @@ public class NotificationSnooze extends LinearLayout
|
|||||||
protected void onFinishInflate() {
|
protected void onFinishInflate() {
|
||||||
super.onFinishInflate();
|
super.onFinishInflate();
|
||||||
mCollapsedHeight = getResources().getDimensionPixelSize(R.dimen.snooze_snackbar_min_height);
|
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);
|
mSelectedOptionText = (TextView) findViewById(R.id.snooze_option_default);
|
||||||
mUndoButton = (TextView) findViewById(R.id.undo);
|
mUndoButton = (TextView) findViewById(R.id.undo);
|
||||||
mUndoButton.setOnClickListener(this);
|
mUndoButton.setOnClickListener(this);
|
||||||
@@ -146,16 +148,6 @@ public class NotificationSnooze extends LinearLayout
|
|||||||
logOptionSelection(MetricsEvent.NOTIFICATION_SNOOZE_CLICKED, mDefaultOption);
|
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
|
@Override
|
||||||
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
public void onInitializeAccessibilityNodeInfo(AccessibilityNodeInfo info) {
|
||||||
super.onInitializeAccessibilityNodeInfo(info);
|
super.onInitializeAccessibilityNodeInfo(info);
|
||||||
@@ -341,12 +333,22 @@ public class NotificationSnooze extends LinearLayout
|
|||||||
mSelectedOptionText.setText(option.getConfirmation());
|
mSelectedOptionText.setText(option.getConfirmation());
|
||||||
showSnoozeOptions(false);
|
showSnoozeOptions(false);
|
||||||
hideSelectedOption();
|
hideSelectedOption();
|
||||||
sendAccessibilityEvent(AccessibilityEvent.TYPE_WINDOW_STATE_CHANGED);
|
|
||||||
if (userAction) {
|
if (userAction) {
|
||||||
|
mSnoozeView.sendAccessibilityEvent(AccessibilityEvent.TYPE_VIEW_FOCUSED);
|
||||||
logOptionSelection(MetricsEvent.NOTIFICATION_SELECT_SNOOZE, option);
|
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) {
|
private void logOptionSelection(int category, SnoozeOption option) {
|
||||||
int index = mSnoozeOptions.indexOf(option);
|
int index = mSnoozeOptions.indexOf(option);
|
||||||
long duration = TimeUnit.MINUTES.toMillis(option.getMinutesToSnoozeFor());
|
long duration = TimeUnit.MINUTES.toMillis(option.getMinutesToSnoozeFor());
|
||||||
|
|||||||
Reference in New Issue
Block a user