Android

com.google.android.maps.TrackballGestureDetector

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

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

Summary

Public Methods

          void  analyze(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(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

Details

Public Methods

public void analyze(MotionEvent ev)

Analyze a MotionEvent. Call this once for each MotionEvent that is received by a view.

Parameters

ev The MotionEvent to analyze.

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.

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.

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.

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.

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.

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.

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.

public void registerLongPressCallback(Runnable runnable)

Register a runnable to be called when a longPress event is detected.

Parameters

runnable The runnable to use for the callback.

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.

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.
Copyright 2007 Google Inc. Build 0.9_r1-98467 - 14 Aug 2008 18:48