com.google.android.maps
Class TrackballGestureDetector

java.lang.Object
  extended by com.google.android.maps.TrackballGestureDetector

public class TrackballGestureDetector
extends java.lang.Object

Analyzes a series of MotionEvent and detects gestures. Right now only very simple gestures are detected: scroll, tap, and double-tap.


Method Summary
 void analyze(android.view.MotionEvent ev)
          Analyze a MotionEvent.
 float getCurrentDownX()
          Returns the X-cordinate position of the current tap event.
 float getCurrentDownY()
          Returns the Y-cordinate position of the current tap event.
 float getFirstDownX()
          Returns the X-cordinate position of the current double-tap event.
 float getFirstDownY()
          Returns the Y-cordinate position of the current double-tap event.
 boolean isDoubleTap()
          Checks whether the current MotionEvent is a double-tap event.
 boolean isScroll()
          Checks whether the current MotionEvent is a scroll event.
 boolean isTap()
          Checks whether the current MotionEvent is a single-tap event.
 void registerLongPressCallback(java.lang.Runnable runnable)
          Register a runnable to be called when a longPress event is detected.
 float scrollX()
          Returns the X-coordinate position of the current scroll event.
 float scrollY()
          Returns the Y-coordinate position of the current scroll event.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

analyze

public void analyze(android.view.MotionEvent ev)
Analyze a MotionEvent. Call this once for each MotionEvent that is received by a view.

Parameters:
ev - The MotionEvent to analyze.

registerLongPressCallback

public void registerLongPressCallback(java.lang.Runnable runnable)
Register a runnable to be called when a longPress event is detected.

Parameters:
runnable - The runnable to use for the callback.

isScroll

public boolean isScroll()
Checks whether the current MotionEvent is a scroll event.

Returns:
True if the current motion event is a scroll event; false otherwise.

scrollX

public float scrollX()
Returns the X-coordinate position of the current scroll event. This value is only defined if isScroll() is true.

Returns:
the X position of the current scroll event.

scrollY

public float scrollY()
Returns the Y-coordinate position of the current scroll event. This value is only defined if isScroll() is true.

Returns:
the Y position of the current scroll event.

isTap

public boolean isTap()
Checks whether the current MotionEvent is a single-tap event.

Returns:
True if the current motion event is a single-tap event; false otherwise.

getCurrentDownX

public float getCurrentDownX()
Returns the X-cordinate position of the current tap event. This value is only defined if either isTap() is true.

Returns:
The X position of the current tap event.

getCurrentDownY

public float getCurrentDownY()
Returns the Y-cordinate position of the current tap event. This value is only defined if either isTap() is true.

Returns:
The Y position of the current tap event.

isDoubleTap

public boolean isDoubleTap()
Checks whether the current MotionEvent is a double-tap event.

Returns:
True if the current motion event is a double-tap event; false otherwise.

getFirstDownX

public float getFirstDownX()
Returns the X-cordinate position of the current double-tap event. This value is only defined if isDoubleTap() is true.

Returns:
The X position of the (first tap in a) double-tap event.

getFirstDownY

public float getFirstDownY()
Returns the Y-cordinate position of the current double-tap event. This value is only defined if isDoubleTap() is true.

Returns:
The Y position of the (first tap in a) double-tap event.