com.esri.android.map
Class MapOnTouchListener

java.lang.Object
  extended by com.esri.android.map.MapOnTouchListener
All Implemented Interfaces:
android.view.View.OnTouchListener, MapGestureDetector.OnGestureListener

public class MapOnTouchListener
extends Object
implements android.view.View.OnTouchListener, MapGestureDetector.OnGestureListener

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.


Constructor Summary
MapOnTouchListener(android.content.Context context, MapView view)
          Instantiates an object of MapOnTouchListener with the activity context and the MapView.
 
Method Summary
 boolean onDoubleTap(android.view.MotionEvent point)
          Notified when a single-pointer-double-tap gesture occurs.
 boolean onDragPointerMove(android.view.MotionEvent from, android.view.MotionEvent to)
          Notified when a part of a single touch drag gesture event occurs.
 boolean onDragPointerUp(android.view.MotionEvent from, android.view.MotionEvent to)
          Notified when a part of a single-touch-drag gesture event occurs.
 void onLongPress(android.view.MotionEvent point)
          Notified when a long-press gesture occurs.
 void onMultiPointersSingleTap(android.view.MotionEvent event)
          Notified when a two-pointers-single-tap gesture occurs.
 boolean onPinchPointersDown(android.view.MotionEvent event)
          Notified when a part of a pinch gesture occurs.
 boolean onPinchPointersMove(android.view.MotionEvent event)
          Notified when a part of a pinch gesture occurs.
 boolean onPinchPointersUp(android.view.MotionEvent event)
          Notified when a part of a pinch gesture occurs.
 boolean onSingleTap(android.view.MotionEvent point)
          Notified when a single-pointer-single-tap gesture occurs.
 boolean onTouch(android.view.View v, android.view.MotionEvent event)
          Called when a touch event is dispatched to a view.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MapOnTouchListener

public MapOnTouchListener(android.content.Context context,
                          MapView view)
Instantiates an object of MapOnTouchListener with the activity context and the MapView.

Parameters:
context - the activity context.
view - the MapView that will be dispatching the events.
Method Detail

onTouch

public boolean onTouch(android.view.View v,
                       android.view.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.

Specified by:
onTouch in interface android.view.View.OnTouchListener
Returns:
True if the listener has consumed the event, false otherwise.

onDragPointerMove

public boolean onDragPointerMove(android.view.MotionEvent from,
                                 android.view.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.

Specified by:
onDragPointerMove in interface MapGestureDetector.OnGestureListener
Parameters:
from - The MotionEvent object containing full information about the "from" point.
to - The MotionEvent object containing full information about the "to" point.
Returns:
True if the listener has consumed the event, false otherwise.
See Also:
onDragPointerUp(MotionEvent, MotionEvent)

onDragPointerUp

public boolean onDragPointerUp(android.view.MotionEvent from,
                               android.view.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.

Specified by:
onDragPointerUp in interface MapGestureDetector.OnGestureListener
Parameters:
from - The MotionEvent object containing full information about the "from" point.
to - The MotionEvent object containing full information about the "to" point.
Returns:
True if the listener has consumed the event, false otherwise.
See Also:
onDragPointerMove(MotionEvent, MotionEvent)

onPinchPointersDown

public boolean onPinchPointersDown(android.view.MotionEvent event)
Notified when a part of a pinch gesture occurs. The gesture has started as a two pointers down motion.

Specified by:
onPinchPointersDown in interface MapGestureDetector.OnGestureListener
Returns:
True if the listener has consumed the event, false otherwise.
See Also:
onPinchPointersMove(MotionEvent), onPinchPointersUp(MotionEvent)

onPinchPointersMove

public boolean onPinchPointersMove(android.view.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);

Specified by:
onPinchPointersMove in interface MapGestureDetector.OnGestureListener
Returns:
True if the listener has consumed the event, false otherwise.
See Also:
onPinchPointersDown(MotionEvent), onPinchPointersUp(MotionEvent)

onPinchPointersUp

public boolean onPinchPointersUp(android.view.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.

Specified by:
onPinchPointersUp in interface MapGestureDetector.OnGestureListener
Returns:
True if the listener has consumed the event, false otherwise.
See Also:
onPinchPointersDown(MotionEvent), onPinchPointersMove(MotionEvent)

onDoubleTap

public boolean onDoubleTap(android.view.MotionEvent point)
Notified when a single-pointer-double-tap gesture occurs. The motion event contains the final movement of the gesture.

Specified by:
onDoubleTap in interface MapGestureDetector.OnGestureListener
Returns:
True if the listener has consumed the event, false otherwise.

onMultiPointersSingleTap

public void onMultiPointersSingleTap(android.view.MotionEvent event)
Notified when a two-pointers-single-tap gesture occurs. The motion event contains the final movement of the gesture.

Specified by:
onMultiPointersSingleTap in interface MapGestureDetector.OnGestureListener

onLongPress

public void onLongPress(android.view.MotionEvent point)
Notified when a long-press gesture occurs. The motion event contains the initial movement of the gesture.

Specified by:
onLongPress in interface MapGestureDetector.OnGestureListener
Parameters:
point - The initial on down motion event that started the longpress.

onSingleTap

public boolean onSingleTap(android.view.MotionEvent point)
Notified when a single-pointer-single-tap gesture occurs. The motion event contains the initial movement of the gesture.

Specified by:
onSingleTap in interface MapGestureDetector.OnGestureListener
Returns:
True if the listener has consumed the event, false otherwise.


Copyright © 2010. All Rights Reserved.