Loading api/current.xml +47 −0 Original line number Diff line number Diff line Loading @@ -217976,6 +217976,17 @@ visibility="public" > </field> <field name="ACTION_SCROLL" type="int" transient="false" volatile="false" value="8" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_UP" type="int" transient="false" Loading Loading @@ -224299,6 +224310,19 @@ <parameter name="l" type="android.view.View.OnFocusChangeListener"> </parameter> </method> <method name="setOnGenericMotionListener" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="l" type="android.view.View.OnGenericMotionListener"> </parameter> </method> <method name="setOnKeyListener" return="void" abstract="false" Loading Loading @@ -226002,6 +226026,29 @@ </parameter> </method> </interface> <interface name="View.OnGenericMotionListener" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onGenericMotion" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="v" type="android.view.View"> </parameter> <parameter name="event" type="android.view.MotionEvent"> </parameter> </method> </interface> <interface name="View.OnKeyListener" abstract="true" static="true" core/java/android/app/Activity.java +10 −13 Original line number Diff line number Diff line Loading @@ -2122,24 +2122,21 @@ public class Activity extends ContextThemeWrapper * Called when a generic motion event was not handled by any of the * views inside of the activity. * <p> * Generic motion events are dispatched to the focused view to describe * the motions of input devices such as joysticks. The * Generic motion events describe joystick movements, mouse hovers, track pad * touches, scroll wheel movements and other input events. The * {@link MotionEvent#getSource() source} of the motion event specifies * the class of input that was received. Implementations of this method * must examine the bits in the source before processing the event. * The following code example shows how this is done. * </p><p> * Generic motion events with source class * {@link android.view.InputDevice#SOURCE_CLASS_POINTER} * are delivered to the view under the pointer. All other generic motion events are * delivered to the focused view. * </p><p> * See {@link View#onGenericMotionEvent(MotionEvent)} for an example of how to * handle this event. * </p> * <code> * public boolean onGenericMotionEvent(MotionEvent event) { * if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { * float x = event.getX(); * float y = event.getY(); * // process the joystick motion * return true; * } * return super.onGenericMotionEvent(event); * } * </code> * * @param event The generic motion event being processed. * Loading core/java/android/app/Dialog.java +10 −13 Original line number Diff line number Diff line Loading @@ -627,24 +627,21 @@ public class Dialog implements DialogInterface, Window.Callback, * Called when a generic motion event was not handled by any of the * views inside of the dialog. * <p> * Generic motion events are dispatched to the focused view to describe * the motions of input devices such as joysticks. The * Generic motion events describe joystick movements, mouse hovers, track pad * touches, scroll wheel movements and other input events. The * {@link MotionEvent#getSource() source} of the motion event specifies * the class of input that was received. Implementations of this method * must examine the bits in the source before processing the event. * The following code example shows how this is done. * </p><p> * Generic motion events with source class * {@link android.view.InputDevice#SOURCE_CLASS_POINTER} * are delivered to the view under the pointer. All other generic motion events are * delivered to the focused view. * </p><p> * See {@link View#onGenericMotionEvent(MotionEvent)} for an example of how to * handle this event. * </p> * <code> * public boolean onGenericMotionEvent(MotionEvent event) { * if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { * float x = event.getX(); * float y = event.getY(); * // process the joystick motion * return true; * } * return super.onGenericMotionEvent(event); * } * </code> * * @param event The generic motion event being processed. * Loading core/java/android/service/wallpaper/WallpaperService.java +9 −8 Original line number Diff line number Diff line Loading @@ -460,6 +460,7 @@ public abstract class WallpaperService extends Service { } private void dispatchPointer(MotionEvent event) { if (event.isTouchEvent()) { synchronized (mLock) { if (event.getAction() == MotionEvent.ACTION_MOVE) { mPendingMove = event; Loading @@ -467,10 +468,10 @@ public abstract class WallpaperService extends Service { mPendingMove = null; } } Message msg = mCaller.obtainMessageO(MSG_TOUCH_EVENT, event); mCaller.sendMessage(msg); } } void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNeeded) { if (mDestroyed) { Loading core/java/android/view/MotionEvent.java +59 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,12 @@ import android.util.SparseArray; * by a motion event with {@link #ACTION_UP} or when gesture is canceled * with {@link #ACTION_CANCEL}. * </p><p> * Some pointing devices such as mice may support vertical and/or horizontal scrolling. * A scroll event is reported as a generic motion event with {@link #ACTION_SCROLL} that * includes the relative scroll offset in the {@link #AXIS_VSCROLL} and * {@link #AXIS_HSCROLL} axes. See {@link #getAxisValue(int)} for information * about retrieving these additional axes. * </p><p> * On trackball devices with source class {@link InputDevice#SOURCE_CLASS_TRACKBALL}, * the pointer coordinates specify relative movements as X/Y deltas. * A trackball gesture consists of a sequence of movements described by motion Loading @@ -51,6 +57,8 @@ import android.util.SparseArray; * The joystick axis values are normalized to a range of -1.0 to 1.0 where 0.0 corresponds * to the center position. More information about the set of available axes and the * range of motion can be obtained using {@link InputDevice#getMotionRange}. * Some common joystick axes are {@link #AXIS_X}, {@link #AXIS_Y}, * {@link #AXIS_HAT_X}, {@link #AXIS_HAT_Y}, {@link #AXIS_Z} and {@link #AXIS_RZ}. * </p><p> * Motion events always report movements for all pointers at once. The number * of pointers only ever changes by one as individual pointers go up and down, Loading Loading @@ -163,9 +171,29 @@ public final class MotionEvent extends InputEvent implements Parcelable { * is not down (unlike {@link #ACTION_MOVE}). The motion contains the most * recent point, as well as any intermediate points since the last * hover move event. * <p> * This action is not a touch event so it is delivered to * {@link View#onGenericMotionEvent(MotionEvent)} rather than * {@link View#onTouchEvent(MotionEvent)}. * </p> */ public static final int ACTION_HOVER_MOVE = 7; /** * Constant for {@link #getAction}: The motion event contains relative * vertical and/or horizontal scroll offsets. Use {@link #getAxisValue(int)} * to retrieve the information from {@link #AXIS_VSCROLL} and {@link #AXIS_HSCROLL}. * The pointer may or may not be down when this event is dispatched. * This action is always delivered to the winder under the pointer, which * may not be the window currently touched. * <p> * This action is not a touch event so it is delivered to * {@link View#onGenericMotionEvent(MotionEvent)} rather than * {@link View#onTouchEvent(MotionEvent)}. * </p> */ public static final int ACTION_SCROLL = 8; /** * Bits in the action code that represent a pointer index, used with * {@link #ACTION_POINTER_DOWN} and {@link #ACTION_POINTER_UP}. Shifting Loading Loading @@ -483,7 +511,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * <p> * <ul> * <li>For a mouse, reports the relative movement of the vertical scroll wheel. * The value is normalized to a range from -1.0 (up) to 1.0 (down). * The value is normalized to a range from -1.0 (down) to 1.0 (up). * </ul> * </p><p> * This axis should be used to scroll views vertically. Loading Loading @@ -1236,6 +1264,32 @@ public final class MotionEvent extends InputEvent implements Parcelable { >> ACTION_POINTER_INDEX_SHIFT; } /** * Returns true if this motion event is a touch event. * <p> * Specifically excludes pointer events with action {@link #ACTION_HOVER_MOVE} * or {@link #ACTION_SCROLL} because they are not actually touch events * (the pointer is not down). * </p> * @return True if this motion event is a touch event. * @hide */ public final boolean isTouchEvent() { if ((getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (getActionMasked()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_OUTSIDE: return true; } } return false; } /** * Gets the motion event flags. * Loading Loading @@ -2174,10 +2228,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { return "ACTION_UP"; case ACTION_CANCEL: return "ACTION_CANCEL"; case ACTION_OUTSIDE: return "ACTION_OUTSIDE"; case ACTION_MOVE: return "ACTION_MOVE"; case ACTION_HOVER_MOVE: return "ACTION_HOVER_MOVE"; case ACTION_SCROLL: return "ACTION_SCROLL"; } int index = (action & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT; switch (action & ACTION_MASK) { Loading Loading
api/current.xml +47 −0 Original line number Diff line number Diff line Loading @@ -217976,6 +217976,17 @@ visibility="public" > </field> <field name="ACTION_SCROLL" type="int" transient="false" volatile="false" value="8" static="true" final="true" deprecated="not deprecated" visibility="public" > </field> <field name="ACTION_UP" type="int" transient="false" Loading Loading @@ -224299,6 +224310,19 @@ <parameter name="l" type="android.view.View.OnFocusChangeListener"> </parameter> </method> <method name="setOnGenericMotionListener" return="void" abstract="false" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="l" type="android.view.View.OnGenericMotionListener"> </parameter> </method> <method name="setOnKeyListener" return="void" abstract="false" Loading Loading @@ -226002,6 +226026,29 @@ </parameter> </method> </interface> <interface name="View.OnGenericMotionListener" abstract="true" static="true" final="false" deprecated="not deprecated" visibility="public" > <method name="onGenericMotion" return="boolean" abstract="true" native="false" synchronized="false" static="false" final="false" deprecated="not deprecated" visibility="public" > <parameter name="v" type="android.view.View"> </parameter> <parameter name="event" type="android.view.MotionEvent"> </parameter> </method> </interface> <interface name="View.OnKeyListener" abstract="true" static="true"
core/java/android/app/Activity.java +10 −13 Original line number Diff line number Diff line Loading @@ -2122,24 +2122,21 @@ public class Activity extends ContextThemeWrapper * Called when a generic motion event was not handled by any of the * views inside of the activity. * <p> * Generic motion events are dispatched to the focused view to describe * the motions of input devices such as joysticks. The * Generic motion events describe joystick movements, mouse hovers, track pad * touches, scroll wheel movements and other input events. The * {@link MotionEvent#getSource() source} of the motion event specifies * the class of input that was received. Implementations of this method * must examine the bits in the source before processing the event. * The following code example shows how this is done. * </p><p> * Generic motion events with source class * {@link android.view.InputDevice#SOURCE_CLASS_POINTER} * are delivered to the view under the pointer. All other generic motion events are * delivered to the focused view. * </p><p> * See {@link View#onGenericMotionEvent(MotionEvent)} for an example of how to * handle this event. * </p> * <code> * public boolean onGenericMotionEvent(MotionEvent event) { * if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { * float x = event.getX(); * float y = event.getY(); * // process the joystick motion * return true; * } * return super.onGenericMotionEvent(event); * } * </code> * * @param event The generic motion event being processed. * Loading
core/java/android/app/Dialog.java +10 −13 Original line number Diff line number Diff line Loading @@ -627,24 +627,21 @@ public class Dialog implements DialogInterface, Window.Callback, * Called when a generic motion event was not handled by any of the * views inside of the dialog. * <p> * Generic motion events are dispatched to the focused view to describe * the motions of input devices such as joysticks. The * Generic motion events describe joystick movements, mouse hovers, track pad * touches, scroll wheel movements and other input events. The * {@link MotionEvent#getSource() source} of the motion event specifies * the class of input that was received. Implementations of this method * must examine the bits in the source before processing the event. * The following code example shows how this is done. * </p><p> * Generic motion events with source class * {@link android.view.InputDevice#SOURCE_CLASS_POINTER} * are delivered to the view under the pointer. All other generic motion events are * delivered to the focused view. * </p><p> * See {@link View#onGenericMotionEvent(MotionEvent)} for an example of how to * handle this event. * </p> * <code> * public boolean onGenericMotionEvent(MotionEvent event) { * if ((event.getSource() & InputDevice.SOURCE_CLASS_JOYSTICK) != 0) { * float x = event.getX(); * float y = event.getY(); * // process the joystick motion * return true; * } * return super.onGenericMotionEvent(event); * } * </code> * * @param event The generic motion event being processed. * Loading
core/java/android/service/wallpaper/WallpaperService.java +9 −8 Original line number Diff line number Diff line Loading @@ -460,6 +460,7 @@ public abstract class WallpaperService extends Service { } private void dispatchPointer(MotionEvent event) { if (event.isTouchEvent()) { synchronized (mLock) { if (event.getAction() == MotionEvent.ACTION_MOVE) { mPendingMove = event; Loading @@ -467,10 +468,10 @@ public abstract class WallpaperService extends Service { mPendingMove = null; } } Message msg = mCaller.obtainMessageO(MSG_TOUCH_EVENT, event); mCaller.sendMessage(msg); } } void updateSurface(boolean forceRelayout, boolean forceReport, boolean redrawNeeded) { if (mDestroyed) { Loading
core/java/android/view/MotionEvent.java +59 −1 Original line number Diff line number Diff line Loading @@ -40,6 +40,12 @@ import android.util.SparseArray; * by a motion event with {@link #ACTION_UP} or when gesture is canceled * with {@link #ACTION_CANCEL}. * </p><p> * Some pointing devices such as mice may support vertical and/or horizontal scrolling. * A scroll event is reported as a generic motion event with {@link #ACTION_SCROLL} that * includes the relative scroll offset in the {@link #AXIS_VSCROLL} and * {@link #AXIS_HSCROLL} axes. See {@link #getAxisValue(int)} for information * about retrieving these additional axes. * </p><p> * On trackball devices with source class {@link InputDevice#SOURCE_CLASS_TRACKBALL}, * the pointer coordinates specify relative movements as X/Y deltas. * A trackball gesture consists of a sequence of movements described by motion Loading @@ -51,6 +57,8 @@ import android.util.SparseArray; * The joystick axis values are normalized to a range of -1.0 to 1.0 where 0.0 corresponds * to the center position. More information about the set of available axes and the * range of motion can be obtained using {@link InputDevice#getMotionRange}. * Some common joystick axes are {@link #AXIS_X}, {@link #AXIS_Y}, * {@link #AXIS_HAT_X}, {@link #AXIS_HAT_Y}, {@link #AXIS_Z} and {@link #AXIS_RZ}. * </p><p> * Motion events always report movements for all pointers at once. The number * of pointers only ever changes by one as individual pointers go up and down, Loading Loading @@ -163,9 +171,29 @@ public final class MotionEvent extends InputEvent implements Parcelable { * is not down (unlike {@link #ACTION_MOVE}). The motion contains the most * recent point, as well as any intermediate points since the last * hover move event. * <p> * This action is not a touch event so it is delivered to * {@link View#onGenericMotionEvent(MotionEvent)} rather than * {@link View#onTouchEvent(MotionEvent)}. * </p> */ public static final int ACTION_HOVER_MOVE = 7; /** * Constant for {@link #getAction}: The motion event contains relative * vertical and/or horizontal scroll offsets. Use {@link #getAxisValue(int)} * to retrieve the information from {@link #AXIS_VSCROLL} and {@link #AXIS_HSCROLL}. * The pointer may or may not be down when this event is dispatched. * This action is always delivered to the winder under the pointer, which * may not be the window currently touched. * <p> * This action is not a touch event so it is delivered to * {@link View#onGenericMotionEvent(MotionEvent)} rather than * {@link View#onTouchEvent(MotionEvent)}. * </p> */ public static final int ACTION_SCROLL = 8; /** * Bits in the action code that represent a pointer index, used with * {@link #ACTION_POINTER_DOWN} and {@link #ACTION_POINTER_UP}. Shifting Loading Loading @@ -483,7 +511,7 @@ public final class MotionEvent extends InputEvent implements Parcelable { * <p> * <ul> * <li>For a mouse, reports the relative movement of the vertical scroll wheel. * The value is normalized to a range from -1.0 (up) to 1.0 (down). * The value is normalized to a range from -1.0 (down) to 1.0 (up). * </ul> * </p><p> * This axis should be used to scroll views vertically. Loading Loading @@ -1236,6 +1264,32 @@ public final class MotionEvent extends InputEvent implements Parcelable { >> ACTION_POINTER_INDEX_SHIFT; } /** * Returns true if this motion event is a touch event. * <p> * Specifically excludes pointer events with action {@link #ACTION_HOVER_MOVE} * or {@link #ACTION_SCROLL} because they are not actually touch events * (the pointer is not down). * </p> * @return True if this motion event is a touch event. * @hide */ public final boolean isTouchEvent() { if ((getSource() & InputDevice.SOURCE_CLASS_POINTER) != 0) { switch (getActionMasked()) { case MotionEvent.ACTION_DOWN: case MotionEvent.ACTION_MOVE: case MotionEvent.ACTION_UP: case MotionEvent.ACTION_POINTER_DOWN: case MotionEvent.ACTION_POINTER_UP: case MotionEvent.ACTION_CANCEL: case MotionEvent.ACTION_OUTSIDE: return true; } } return false; } /** * Gets the motion event flags. * Loading Loading @@ -2174,10 +2228,14 @@ public final class MotionEvent extends InputEvent implements Parcelable { return "ACTION_UP"; case ACTION_CANCEL: return "ACTION_CANCEL"; case ACTION_OUTSIDE: return "ACTION_OUTSIDE"; case ACTION_MOVE: return "ACTION_MOVE"; case ACTION_HOVER_MOVE: return "ACTION_HOVER_MOVE"; case ACTION_SCROLL: return "ACTION_SCROLL"; } int index = (action & ACTION_POINTER_INDEX_MASK) >> ACTION_POINTER_INDEX_SHIFT; switch (action & ACTION_MASK) { Loading