public class

MapOnTouchListener

extends Object
implements View.OnTouchListener MapGestureDetector.OnGestureListener
java.lang.Object
   ↳ com.esri.android.map.MapOnTouchListener

Class Overview

An interface definition for a callback to be invoked when a touch event is dispatched to a MapView. The callback will be invoked before the touch event is given to the MapView.

Summary

Constants
int PINCH_ZOOM_TOLERANECE_INDEGREE The minimum angle, in degrees, required in a pinch gesture to initiate a pinch-to-rotate operation.
int SENSITIVITY_TOLERANCE_INPIXEL The minimum pointer movement distance, in pixels, required in a pinch gesture to initiate a pinch-to-rotate operation.
Public Constructors
MapOnTouchListener(Context context, MapView view)
Instantiates an object of MapOnTouchListener with the activity context and the MapView.
Public Methods
boolean onDoubleTap(MotionEvent point)
Notified when a single-pointer-double-tap gesture occurs.
boolean onDoubleTapDrag(MotionEvent from, MotionEvent to)
Notified when part of a double-tap-then-drag gesture occurs.
boolean onDoubleTapDragUp(MotionEvent up)
Notified when the end of a double-tap-then-drag gesture occurs.
boolean onDragPointerMove(MotionEvent from, MotionEvent to)
Notified when a part of a single touch drag gesture event occurs.
boolean onDragPointerUp(MotionEvent from, MotionEvent to)
Notified when a part of a single-touch-drag gesture event occurs.
boolean onFling(MotionEvent from, MotionEvent to, float velocityX, float velocityY)
Notified when a fling gesture occurs.
void onLongPress(MotionEvent point)
Notified when a long-press gesture occurs.
boolean onLongPressUp(MotionEvent point)
Notified when a long-press gesture has finished.
void onMultiPointersSingleTap(MotionEvent event)
Notified when a two-pointers-single-tap gesture occurs.
boolean onPinchPointersDown(MotionEvent event)
Notified when a part of a pinch gesture occurs.
boolean onPinchPointersMove(MotionEvent event)
Notified when a part of a pinch gesture occurs.
boolean onPinchPointersUp(MotionEvent event)
Notified when a part of a pinch gesture occurs.
boolean onSingleTap(MotionEvent point)
Notified when a single-pointer-single-tap gesture occurs.
boolean onTouch(View v, MotionEvent event)
Called when a touch event is dispatched to a view.
[Expand]
Inherited Methods
From class java.lang.Object
From interface android.view.View.OnTouchListener
From interface com.esri.android.map.MapGestureDetector.OnGestureListener

Constants

public static final int PINCH_ZOOM_TOLERANECE_INDEGREE

The minimum angle, in degrees, required in a pinch gesture to initiate a pinch-to-rotate operation. When isAllowRotationByPinch() is true, a two-finger pinch gesture allows the user to not only zoom the map, but also rotate it. Only pinch gestures with a rotation angle greater than this number of degrees will begin a zoom-and-rotate operation; however, the gesture will always begin a zoom operation. Default is 60. See also SENSITIVITY_TOLERANCE_INPIXEL.

Constant Value: 60 (0x0000003c)

public static final int SENSITIVITY_TOLERANCE_INPIXEL

The minimum pointer movement distance, in pixels, required in a pinch gesture to initiate a pinch-to-rotate operation. When isAllowRotationByPinch() is true, a two-finger pinch gesture allows the user to not only zoom the map, but also rotate it. Only pinch gestures which move either pointer greater than than this number of pixels will begin a zoom-and-rotate operation; however, the gesture will always begin a zoom operation. Default is 5. See also PINCH_ZOOM_TOLERANECE_INDEGREE.

Constant Value: 5 (0x00000005)

Public Constructors

public MapOnTouchListener (Context context, MapView view)

Instantiates an object of MapOnTouchListener with the activity context and the MapView.

Parameters
context Context: the activity context.
view MapView: the MapView that will be dispatching the events.

Public Methods

public boolean onDoubleTap (MotionEvent point)

Notified when a single-pointer-double-tap gesture occurs. The motion event contains the final movement of the gesture.

Parameters
point MotionEvent: the point
Returns
boolean True if the listener has consumed the event, false otherwise.

public boolean onDoubleTapDrag (MotionEvent from, MotionEvent to)

Notified when part of a double-tap-then-drag gesture occurs. This occurs when, rather than immediately lifting the second pointer on a double tap, the pointer is instead dragged or moved. Note that if you override this method and want double-tap-drag zooming to continue to work, call super.onDoubleTapDrag(from, to) after handling the event. The default implementation will perform a zoom, but only after a certain threshold (2% of the screen) is traversed up or down. Any movement within this threshold will be ignored. When overriding this method, the threshold will no longer apply, and even miniscule movements will trigger this event.

Parameters
from MotionEvent: The original down event of the double tap
to MotionEvent: The current position of the pointer
Returns
boolean true if the event is consumed by the listener, otherwise false

public boolean onDoubleTapDragUp (MotionEvent up)

Notified when the end of a double-tap-then-drag gesture occurs. This is triggered when the pointer is lifted from the second tap/drag. Note that if you override this method and want double-tap-drag zooming to continue to work, call super.onDoubleTapDragUp(up) after handling the event.The default implementation will perform a zoom, but only after a certain threshold (2% of the screen) is traversed up or down. Any movement within this threshold will be ignored. When overriding this method, the threshold will no longer apply, and even miniscule movements will trigger this event.

Parameters
up MotionEvent: The motion event corresponding to the pointer being lifted
Returns
boolean true if the event is consumed by the listener, otherwise false

public boolean onDragPointerMove (MotionEvent from, MotionEvent to)

Notified when a part of a single touch drag gesture event occurs. The touch pointer is moving from the "from" point to the "to" point.

Parameters
from MotionEvent: The MotionEvent object containing full information about the "from" point.
to MotionEvent: The MotionEvent object containing full information about the "to" point.
Returns
boolean True if the listener has consumed the event, false otherwise.

public boolean onDragPointerUp (MotionEvent from, MotionEvent to)

Notified when a part of a single-touch-drag gesture event occurs. The drag gesture has finished. The motion events contain the final movement of the gesture.

Parameters
from MotionEvent: The MotionEvent object containing full information about the "from" point.
to MotionEvent: The MotionEvent object containing full information about the "to" point.
Returns
boolean True if the listener has consumed the event, false otherwise.

public boolean onFling (MotionEvent from, MotionEvent to, float velocityX, float velocityY)

Notified when a fling gesture occurs.

Parameters
from MotionEvent: MotionEvent
to MotionEvent: MotionEvent
velocityX float: float
velocityY float: float
Returns
boolean boolean true if the event is consumed by listener. since 10.2.2

public void onLongPress (MotionEvent point)

Notified when a long-press gesture occurs. The motion event contains the initial movement of the gesture. Note that if you override this method and want the magnifier continue to work, call super.onLongPress(point) after handling the event.

Parameters
point MotionEvent: The initial on down motion event that started the longpress.

public boolean onLongPressUp (MotionEvent point)

Notified when a long-press gesture has finished. The motion event contains the final movement of the gesture. Note that if you override this method and want the magnifier continue to work, call super.onLongPressUp(point) after handling the event. This event might occur in addition to onDragPointerUp(MotionEvent, MotionEvent).

Parameters
point MotionEvent: The initial on down motion event that started the longpress.
Returns
boolean true if the listener has consumed the event, false otherwise.

public void onMultiPointersSingleTap (MotionEvent event)

Notified when a two-pointers-single-tap gesture occurs. The motion event contains the final movement of the gesture.

Parameters
event MotionEvent: the event

public boolean onPinchPointersDown (MotionEvent event)

Notified when a part of a pinch gesture occurs. The gesture has started as a two pointers down motion.

Parameters
event MotionEvent: the event
Returns
boolean True if the listener has consumed the event, false otherwise.

public boolean onPinchPointersMove (MotionEvent event)

Notified when a part of a pinch gesture occurs. The two pointers of the gesture have moved. To get the move pointers you can:

float x1 = event.getX(0), y1 = event.getY(0), x2 = event.getX(1), y2 = event.getY(1);

Parameters
event MotionEvent: the event
Returns
boolean True if the listener has consumed the event, false otherwise.

public boolean onPinchPointersUp (MotionEvent event)

Notified when a part of a pinch gesture occurs. The pinch gesture has finished. The motion event contains the final movement of the gesture.

Parameters
event MotionEvent: the event
Returns
boolean True if the listener has consumed the event, false otherwise.

public boolean onSingleTap (MotionEvent point)

Notified when a single-pointer-single-tap gesture occurs. The motion event contains the initial movement of the gesture.

Parameters
point MotionEvent: the point
Returns
boolean True if the listener has consumed the event, false otherwise.

public boolean onTouch (View v, MotionEvent event)

Called when a touch event is dispatched to a view. This allows listeners to get a chance to respond before the target MapView.

Parameters
v View: the v
event MotionEvent: the event
Returns
boolean True if the listener has consumed the event, false otherwise.