From 4f3ab931478ea14cf4cc19f3acf6eb6040635225 Mon Sep 17 00:00:00 2001 From: Mady Mellor Date: Wed, 25 May 2016 09:49:02 -0700 Subject: [PATCH] Changes based on API council feedback for performContextClick Added an overloaded version with (float x, float y). Fixes: 28295818 Change-Id: I41c2bf225964436655986b3ad4d0c630c658e38b --- api/current.txt | 1 + api/system-current.txt | 1 + api/test-current.txt | 1 + core/java/android/view/View.java | 14 +++++++++++++- 4 files changed, 16 insertions(+), 1 deletion(-) diff --git a/api/current.txt b/api/current.txt index 70ea1c577134e..c8404ac6f4454 100644 --- a/api/current.txt +++ b/api/current.txt @@ -42501,6 +42501,7 @@ package android.view { method protected boolean overScrollBy(int, int, int, int, int, int, int, int, boolean); method public boolean performAccessibilityAction(int, android.os.Bundle); method public boolean performClick(); + method public boolean performContextClick(float, float); method public boolean performContextClick(); method public boolean performHapticFeedback(int); method public boolean performHapticFeedback(int, int); diff --git a/api/system-current.txt b/api/system-current.txt index a6f612d195bf6..e5dba7831b6b4 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -45499,6 +45499,7 @@ package android.view { method protected boolean overScrollBy(int, int, int, int, int, int, int, int, boolean); method public boolean performAccessibilityAction(int, android.os.Bundle); method public boolean performClick(); + method public boolean performContextClick(float, float); method public boolean performContextClick(); method public boolean performHapticFeedback(int); method public boolean performHapticFeedback(int, int); diff --git a/api/test-current.txt b/api/test-current.txt index 37bc7afb69ef1..1c21f724b6eb9 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -42580,6 +42580,7 @@ package android.view { method protected boolean overScrollBy(int, int, int, int, int, int, int, int, boolean); method public boolean performAccessibilityAction(int, android.os.Bundle); method public boolean performClick(); + method public boolean performContextClick(float, float); method public boolean performContextClick(); method public boolean performHapticFeedback(int); method public boolean performHapticFeedback(int, int); diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index 2269282a57711..f1f4964b7b60d 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5695,6 +5695,18 @@ public class View implements Drawable.Callback, KeyEvent.Callback, return handled; } + /** + * Call this view's OnContextClickListener, if it is defined. + * + * @param x the x coordinate of the context click + * @param y the y coordinate of the context click + * @return True if there was an assigned OnContextClickListener that consumed the event, false + * otherwise. + */ + public boolean performContextClick(float x, float y) { + return performContextClick(); + } + /** * Call this view's OnContextClickListener, if it is defined. * @@ -10044,7 +10056,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, if (isContextClickable() && !mInContextButtonPress && !mHasPerformedLongPress && (actionButton == MotionEvent.BUTTON_STYLUS_PRIMARY || actionButton == MotionEvent.BUTTON_SECONDARY)) { - if (performContextClick()) { + if (performContextClick(event.getX(), event.getY())) { mInContextButtonPress = true; setPressed(true, event.getX(), event.getY()); removeTapCallback();