diff options
| author | 2020-12-03 01:15:09 +0000 | |
|---|---|---|
| committer | 2020-12-03 01:15:09 +0000 | |
| commit | f8309b769869b44eb8a959eee3dad40fad71881d (patch) | |
| tree | 59c2064057153ad53bdcab10e7066a5c04e0104e | |
| parent | e63472b52f4629a483c0dfcf915d408f2ac4f267 (diff) | |
| parent | 99441dfe3e96529756a8deec55ef4825b2f78d51 (diff) | |
Merge "Include touchpad capture in View#requestPointerCapture docs"
| -rw-r--r-- | core/java/android/view/View.java | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/core/java/android/view/View.java b/core/java/android/view/View.java index a5c66537b11f..29cc4b507acc 100644 --- a/core/java/android/view/View.java +++ b/core/java/android/view/View.java @@ -27953,10 +27953,26 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * Requests pointer capture mode. * <p> * When the window has pointer capture, the mouse pointer icon will disappear and will not - * change its position. Further mouse will be dispatched with the source - * {@link InputDevice#SOURCE_MOUSE_RELATIVE}, and relative position changes will be available - * through {@link MotionEvent#getX} and {@link MotionEvent#getY}. Non-mouse events - * (touchscreens, or stylus) will not be affected. + * change its position. Enabling pointer capture will change the behavior of input devices in + * the following ways: + * <ul> + * <li>Events from a mouse will be delivered with the source + * {@link InputDevice#SOURCE_MOUSE_RELATIVE}, and relative position changes will be + * available through {@link MotionEvent#getX} and {@link MotionEvent#getY}.</li> + * + * <li>Events from a touchpad will be delivered with the source + * {@link InputDevice#SOURCE_TOUCHPAD}, where the absolute position of each of the pointers + * on the touchpad will be available through {@link MotionEvent#getX(int)} and + * {@link MotionEvent#getY(int)}, and their relative movements are stored in + * {@link MotionEvent#AXIS_RELATIVE_X} and {@link MotionEvent#AXIS_RELATIVE_Y}.</li> + * + * <li>Events from other types of devices, such as touchscreens, will not be affected.</li> + * </ul> + * <p> + * Events captured through pointer capture will be dispatched to + * {@link OnCapturedPointerListener#onCapturedPointer(View, MotionEvent)} if an + * {@link OnCapturedPointerListener} is set, and otherwise to + * {@link #onCapturedPointerEvent(MotionEvent)}. * <p> * If the window already has pointer capture, this call does nothing. * <p> @@ -27965,6 +27981,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * * @see #releasePointerCapture() * @see #hasPointerCapture() + * @see #onPointerCaptureChange(boolean) */ public void requestPointerCapture() { final ViewRootImpl viewRootImpl = getViewRootImpl(); @@ -27980,6 +27997,7 @@ public class View implements Drawable.Callback, KeyEvent.Callback, * If the window does not have pointer capture, this call will do nothing. * @see #requestPointerCapture() * @see #hasPointerCapture() + * @see #onPointerCaptureChange(boolean) */ public void releasePointerCapture() { final ViewRootImpl viewRootImpl = getViewRootImpl(); |