diff options
author | Jason Monk <jmonk@google.com> | 2014-04-15 15:23:31 -0400 |
---|---|---|
committer | Jason Monk <jmonk@google.com> | 2014-04-22 10:27:01 -0400 |
commit | 02dd7aea3d8ac94126a8f8069e6762592ea60326 (patch) | |
tree | 6f6a7148844498dd5766e6cfc49db437c5ddd184 /src/com/android/launcher3/Utilities.java | |
parent | f2a791a798ce24d81f3410c83873087690db4ffd (diff) | |
download | packages_apps_Trebuchet-02dd7aea3d8ac94126a8f8069e6762592ea60326.tar.gz packages_apps_Trebuchet-02dd7aea3d8ac94126a8f8069e6762592ea60326.tar.bz2 packages_apps_Trebuchet-02dd7aea3d8ac94126a8f8069e6762592ea60326.zip |
Fix long press after already moving off icon
When an icon is in the Hotseat and a user drags off from the icon,
but continues holding down, the icon gets a long press triggered
by the CheckLongPressHelper.
To fix this a check has been added on move events to see if the
point has moved outside the view and to cancel the long press
check callback if it has.
Bug: 13569451
Change-Id: Id175cdc220d70b5e9f8e492ed5a3cc7c3f11db10
Diffstat (limited to 'src/com/android/launcher3/Utilities.java')
-rw-r--r-- | src/com/android/launcher3/Utilities.java | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/com/android/launcher3/Utilities.java b/src/com/android/launcher3/Utilities.java index cbc978585..8deadf1d9 100644 --- a/src/com/android/launcher3/Utilities.java +++ b/src/com/android/launcher3/Utilities.java @@ -305,6 +305,17 @@ public final class Utilities { return scale; } + /** + * Utility method to determine whether the given point, in local coordinates, + * is inside the view, where the area of the view is expanded by the slop factor. + * This method is called while processing touch-move events to determine if the event + * is still within the view. + */ + public static boolean pointInView(View v, float localX, float localY, float slop) { + return localX >= -slop && localY >= -slop && localX < (v.getWidth() + slop) && + localY < (v.getHeight() + slop); + } + private static void initStatics(Context context) { final Resources resources = context.getResources(); final DisplayMetrics metrics = resources.getDisplayMetrics(); |