English | Site Directory

Android - An Open Handset Alliance Project

com.google.android.maps.TrackballGestureDetector

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

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

Summary

Public Constructors

          TrackballGestureDetector(Handler handler)

Public Methods

        void  analyze(MotionEvent ev)
Analyze a motion event.
        float  getCurrentDownX()
This value is only defined if either isTap() is true.
        float  getCurrentDownY()
This value is only defined if either isTap() is true.
        float  getFirstDownX()
This value is only defined if isDoubleTap() is true.
        float  getFirstDownY()
This value is only defined if isDoubleTap() is true.
        boolean  isDoubleTap()
        boolean  isScroll()
        boolean  isTap()
        void  registerLongPressCallback(Runnable runnable)
Register a runnable to be called when a longPress event is detected.
        float  scrollX()
This value is only defined if isScroll() is true.
        float  scrollY()
This value is only defined if isScroll() is true.
Methods inherited from class java.lang.Object

Details

Public Constructors

public TrackballGestureDetector(Handler handler)

Public Methods

public void analyze(MotionEvent ev)

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

Parameters

ev the motion event to analyze.

public float getCurrentDownX()

This value is only defined if either isTap() is true.

Returns

  • the X position of the current tap event.

public float getCurrentDownY()

This value is only defined if either isTap() is true.

Returns

  • the Y position of the current tap event.

public float getFirstDownX()

This value is only defined if isDoubleTap() is true. This returns the X position of the first down X in the double tap.

Returns

  • the X position of the double tap event.

public float getFirstDownY()

This value is only defined if isDoubleTap() is true. This returns the Y position of the first down Y in the double tap.

Returns

  • the Y position of the double tap event.

public boolean isDoubleTap()

Returns

  • true if the current motion event is a double-tap event.

public boolean isScroll()

Returns

  • true if the current motion event is a scroll event.

public boolean isTap()

Returns

  • true if the current motion event is a single-tap event.

public void registerLongPressCallback(Runnable runnable)

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

public float scrollX()

This value is only defined if isScroll() is true.

Returns

  • the X position of the current scroll event. event.

public float scrollY()

This value is only defined if isScroll() is true.

Returns

  • the Y position of the current scroll event. event.
Build m5-rc15i - 10 Jun 2008 13:54