Fixed the interactivness of the shelf on the keyguard

The shelf could still be double-tapped on the lock screen.

Test: manual, tap on bottom part of last notification on lockscreen
Change-Id: Ic5ceb729e28095b90e96da85acd3da3d65110ccf
Fixes: 33766648
This commit is contained in:
Selim Cinek
2017-01-13 17:10:38 -08:00
parent c25af40002
commit c681346ad6
2 changed files with 18 additions and 5 deletions

View File

@@ -251,7 +251,7 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
@Override
public boolean onTouchEvent(MotionEvent event) {
boolean result;
if (mDimmed && !isTouchExplorationEnabled()) {
if (mDimmed && !isTouchExplorationEnabled() && isInteractive()) {
boolean wasActivated = mActivated;
result = handleTouchEventDimmed(event);
if (wasActivated && result && event.getAction() == MotionEvent.ACTION_UP) {
@@ -263,6 +263,13 @@ public abstract class ActivatableNotificationView extends ExpandableOutlineView
return result;
}
/**
* @return whether this view is interactive and can be double tapped
*/
protected boolean isInteractive() {
return true;
}
@Override
public void drawableHotspotChanged(float x, float y) {
if (!mDimmed){

View File

@@ -67,6 +67,7 @@ public class NotificationShelf extends ActivatableNotificationView {
private int mStatusBarState;
private float mMaxShelfEnd;
private int mRelativeOffset;
private boolean mInteractive;
public NotificationShelf(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -555,13 +556,18 @@ public class NotificationShelf extends ActivatableNotificationView {
}
private void updateInteractiveness() {
boolean interactive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf;
setClickable(interactive);
setFocusable(interactive);
setImportantForAccessibility(interactive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
mInteractive = mStatusBarState == StatusBarState.KEYGUARD && mHasItemsInStableShelf;
setClickable(mInteractive);
setFocusable(mInteractive);
setImportantForAccessibility(mInteractive ? View.IMPORTANT_FOR_ACCESSIBILITY_YES
: View.IMPORTANT_FOR_ACCESSIBILITY_NO);
}
@Override
protected boolean isInteractive() {
return mInteractive;
}
public void setMaxShelfEnd(float maxShelfEnd) {
mMaxShelfEnd = maxShelfEnd;
}