diff options
Diffstat (limited to 'quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java')
-rw-r--r-- | quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java index fbab59531c..c998d9704e 100644 --- a/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java +++ b/quickstep/src/com/android/launcher3/taskbar/bubbles/BubbleStashedHandleViewController.java @@ -24,6 +24,7 @@ import android.animation.ValueAnimator; import android.content.res.Resources; import android.graphics.Outline; import android.graphics.Rect; +import android.view.MotionEvent; import android.view.View; import android.view.ViewOutlineProvider; @@ -268,4 +269,22 @@ public class BubbleStashedHandleViewController { }); return revealAnim; } + + /** Checks that the stash handle is visible and that the motion event is within bounds. */ + public boolean isEventOverHandle(MotionEvent ev) { + if (mStashedHandleView.getVisibility() != VISIBLE) { + return false; + } + + // the bounds of the handle only include the visible part, so we check that the Y coordinate + // is anywhere within the stashed taskbar height. + int top = mActivity.getDeviceProfile().heightPx - mStashedTaskbarHeight; + + return (int) ev.getRawY() >= top && containsX((int) ev.getRawX()); + } + + /** Checks if the given x coordinate is within the stashed handle bounds. */ + public boolean containsX(int x) { + return x >= mStashedHandleBounds.left && x <= mStashedHandleBounds.right; + } } |