This lead to an issue where notifications on the very bottom weren't
clickable.
Test: add single notification on the bottom, click it
Change-Id: I444a8de60bec6dda2227a2df4d78c2564c59aa2b
Fixes:
33643806
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="@dimen/notification_shelf_height"
+ android:contentDescription="@string/notification_shelf_content_description"
android:focusable="true"
android:clickable="true"
>
<!-- Content description of the button for showing a notifications panel in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_notifications_button">Notifications.</string>
+ <!-- Content description of overflow icon container of the notifications for accessibility (not shown on the screen)[CHAR LIMIT=NONE] -->
+ <string name="notification_shelf_content_description">Notification overflow container</string>
+
<!-- Content description of the button for removing a notification in the notification panel for accessibility (not shown on the screen). [CHAR LIMIT=NONE] -->
<string name="accessibility_remove_notification">Clear notification.</string>
private boolean mHasItemsInStableShelf;
private NotificationIconContainer mCollapsedIcons;
private int mScrollFastThreshold;
+ private int mStatusBarState;
public NotificationShelf(Context context, AttributeSet attrs) {
super(context, attrs);
}
private void setHasItemsInStableShelf(boolean hasItemsInStableShelf) {
- mHasItemsInStableShelf = hasItemsInStableShelf;
+ if (mHasItemsInStableShelf != hasItemsInStableShelf) {
+ mHasItemsInStableShelf = hasItemsInStableShelf;
+ updateInteractiveness();
+ }
}
/**
mCollapsedIcons = collapsedIcons;
}
+ public void setStatusBarState(int statusBarState) {
+ if (mStatusBarState != statusBarState) {
+ mStatusBarState = statusBarState;
+ updateInteractiveness();
+ }
+ }
+
+ private void updateInteractiveness() {
+ boolean interactive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf;
+ setClickable(interactive);
+ setFocusable(interactive);
+ setImportantForAccessibility(interactive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
+ : View.IMPORTANT_FOR_ACCESSIBILITY_NO);
+ }
+
private class ShelfState extends ExpandableViewState {
private float openedAmount;
private boolean hasItemsInStableShelf;
array.clear();
}
- private final View.OnClickListener mShelfClickListener = new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- if (mState == StatusBarState.KEYGUARD) {
- goToLockedShade(null);
- }
+ private final View.OnClickListener mGoToLockedShadeListener = v -> {
+ if (mState == StatusBarState.KEYGUARD) {
+ goToLockedShade(null);
}
};
private HashMap<ExpandableNotificationRow, List<ExpandableNotificationRow>> mTmpChildOrderMap
(NotificationShelf) LayoutInflater.from(mContext).inflate(
R.layout.status_bar_notification_shelf, mStackScroller, false);
mNotificationShelf.setOnActivatedListener(this);
- mNotificationShelf.setOnClickListener(mShelfClickListener);
mStackScroller.setShelf(mNotificationShelf);
+ mNotificationShelf.setOnClickListener(mGoToLockedShadeListener);
+ mNotificationShelf.setStatusBarState(mState);
}
@Override
mStackScroller.setStatusBarState(state);
updateReportRejectedTouchVisibility();
updateDozing();
+ mNotificationShelf.setStatusBarState(state);
}
@Override