diff options
author | Adrian Roos <roosa@google.com> | 2015-06-10 17:47:12 -0700 |
---|---|---|
committer | Adrian Roos <roosa@google.com> | 2015-06-10 17:47:27 -0700 |
commit | e0c1890bdc5482a4d29aba683115a7133ab58950 (patch) | |
tree | 57065ad953b45fc83a10f5b11bf0e70156114308 /packages | |
parent | cd55f43db60c2f641252d829bd3f532358625834 (diff) | |
download | frameworks_base-e0c1890bdc5482a4d29aba683115a7133ab58950.zip frameworks_base-e0c1890bdc5482a4d29aba683115a7133ab58950.tar.gz frameworks_base-e0c1890bdc5482a4d29aba683115a7133ab58950.tar.bz2 |
Filter hover events for clipped views
Fixes a bug where hovering would select a view even
if the hovered part was clipped away.
Bug: 21763049
Change-Id: I1bbe700cf15d467d570a16bf474e62a477e4bb51
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java index e12c226..cf02090 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/ExpandableView.java @@ -133,6 +133,14 @@ public abstract class ExpandableView extends FrameLayout { } @Override + public boolean dispatchGenericMotionEvent(MotionEvent ev) { + if (filterMotionEvent(ev)) { + return super.dispatchGenericMotionEvent(ev); + } + return false; + } + + @Override public boolean dispatchTouchEvent(MotionEvent ev) { if (filterMotionEvent(ev)) { return super.dispatchTouchEvent(ev); @@ -142,6 +150,8 @@ public abstract class ExpandableView extends FrameLayout { protected boolean filterMotionEvent(MotionEvent event) { return event.getActionMasked() != MotionEvent.ACTION_DOWN + && event.getActionMasked() != MotionEvent.ACTION_HOVER_ENTER + && event.getActionMasked() != MotionEvent.ACTION_HOVER_MOVE || event.getY() > mClipTopAmount && event.getY() < mActualHeight; } @@ -343,6 +353,7 @@ public abstract class ExpandableView extends FrameLayout { public void getBoundsOnScreen(Rect outRect, boolean clipToParent) { super.getBoundsOnScreen(outRect, clipToParent); outRect.bottom = (int) (outRect.top + getActualHeight()); + outRect.top += getClipTopAmount(); } public int getContentHeight() { |