diff --git a/api/current.txt b/api/current.txt index 2d4eb4eef528e..7688eaeed94e8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -42676,6 +42676,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 9f858e63a45f8..c00093a4e462e 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -45674,6 +45674,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 fbbddf9b00b0a..4122a4fef92e2 100644 --- a/api/test-current.txt +++ b/api/test-current.txt @@ -42756,6 +42756,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 e45d492524944..99f2439800fe7 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -5697,6 +5697,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. * @@ -10048,7 +10060,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();