public class TouchInput extends java.lang.Object implements android.view.View.OnTouchListener, android.view.ScaleGestureDetector.OnScaleGestureListener, RotateGestureDetector.OnRotateGestureListener, android.view.GestureDetector.OnGestureListener, android.view.GestureDetector.OnDoubleTapListener, ShoveGestureDetector.OnShoveGestureListener
TouchInput collects touch data, applies gesture detectors, resolves simultaneous
detection, and calls the appropriate input responders.| Modifier and Type | Class and Description |
|---|---|
static interface |
TouchInput.DoubleTapResponder
Interface for responding to a double-tap gesture
|
static class |
TouchInput.Gestures
List of gestures that can be detected and responded to
|
static interface |
TouchInput.LongPressResponder
Interface for responding to a long press gesture
|
static interface |
TouchInput.PanResponder
Interface for responding to a panning (dragging) gesture
|
static interface |
TouchInput.RotateResponder
Interface for responding to a rotation gesture
|
static interface |
TouchInput.ScaleResponder
Interface for responding to a scaling (pinching) gesture
|
static interface |
TouchInput.ShoveResponder
Interface for responding to a shove (two-finger vertical drag) gesture
|
static interface |
TouchInput.TapResponder
Interface for responding to a tap gesture
|
| Constructor and Description |
|---|
TouchInput(android.content.Context context)
Construct a new touch input manager; this may only be called on the UI thread
|
TouchInput(android.content.Context context,
MapController mapController)
Construct a new touch input manager; this may only be called on the UI thread
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
isSimultaneousDetectionAllowed(TouchInput.Gestures first,
TouchInput.Gestures second)
Get whether the gesture
second can be recognized while first is in progress |
boolean |
onDoubleTap(android.view.MotionEvent e) |
boolean |
onDoubleTapEvent(android.view.MotionEvent e) |
boolean |
onDown(android.view.MotionEvent e) |
boolean |
onFling(android.view.MotionEvent e1,
android.view.MotionEvent e2,
float velocityX,
float velocityY) |
void |
onLongPress(android.view.MotionEvent e) |
boolean |
onRotate(RotateGestureDetector detector) |
boolean |
onRotateBegin(RotateGestureDetector detector) |
void |
onRotateEnd(RotateGestureDetector detector) |
boolean |
onScale(android.view.ScaleGestureDetector detector) |
boolean |
onScaleBegin(android.view.ScaleGestureDetector detector) |
void |
onScaleEnd(android.view.ScaleGestureDetector detector) |
boolean |
onScroll(android.view.MotionEvent e1,
android.view.MotionEvent e2,
float distanceX,
float distanceY) |
boolean |
onShove(ShoveGestureDetector detector) |
boolean |
onShoveBegin(ShoveGestureDetector detector) |
void |
onShoveEnd(ShoveGestureDetector detector) |
void |
onShowPress(android.view.MotionEvent e) |
boolean |
onSingleTapConfirmed(android.view.MotionEvent e) |
boolean |
onSingleTapUp(android.view.MotionEvent e) |
boolean |
onTouch(android.view.View v,
android.view.MotionEvent event) |
void |
setDoubleTapResponder(TouchInput.DoubleTapResponder responder)
|
void |
setLongPressResponder(TouchInput.LongPressResponder responder)
|
void |
setPanResponder(TouchInput.PanResponder responder)
Set a
TouchInput.PanResponder |
void |
setRotateResponder(TouchInput.RotateResponder responder)
|
void |
setScaleResponder(TouchInput.ScaleResponder responder)
|
void |
setShoveResponder(TouchInput.ShoveResponder responder)
|
void |
setSimultaneousDetectionAllowed(TouchInput.Gestures first,
TouchInput.Gestures second,
boolean allowed)
Set whether the gesture
second can be recognized while first is in progress |
void |
setTapResponder(TouchInput.TapResponder responder)
Set a
TouchInput.TapResponder |
public TouchInput(android.content.Context context)
context - A Context whose Handler will be used for deferred eventspublic TouchInput(android.content.Context context,
MapController mapController)
context - A Context whose Handler will be used for deferred eventspublic void setTapResponder(TouchInput.TapResponder responder)
TouchInput.TapResponderresponder - The responder object, or null to leave these gesture events unchangedpublic void setDoubleTapResponder(TouchInput.DoubleTapResponder responder)
responder - The responder object, or null to leave these gesture events unchangedpublic void setLongPressResponder(TouchInput.LongPressResponder responder)
responder - The responder object, or null to leave these gesture events unchangedpublic void setPanResponder(TouchInput.PanResponder responder)
TouchInput.PanResponderresponder - The responder object, or null to leave these gesture events unchangedpublic void setScaleResponder(TouchInput.ScaleResponder responder)
responder - The responder object, or null to leave these gesture events unchangedpublic void setRotateResponder(TouchInput.RotateResponder responder)
responder - The responder object, or null to leave these gesture events unchangedpublic void setShoveResponder(TouchInput.ShoveResponder responder)
responder - The responder object, or null to leave these gesture events unchangedpublic void setSimultaneousDetectionAllowed(TouchInput.Gestures first, TouchInput.Gestures second, boolean allowed)
second can be recognized while first is in progressfirst - Initial gesture typesecond - Subsequent gesture typeallowed - True if second should be recognized, else falsepublic boolean isSimultaneousDetectionAllowed(TouchInput.Gestures first, TouchInput.Gestures second)
second can be recognized while first is in progressfirst - Initial gesture typesecond - Subsequent gesture typesecond will be recognized, else falsepublic boolean onTouch(android.view.View v,
android.view.MotionEvent event)
onTouch in interface android.view.View.OnTouchListenerpublic boolean onSingleTapConfirmed(android.view.MotionEvent e)
onSingleTapConfirmed in interface android.view.GestureDetector.OnDoubleTapListenerpublic boolean onDoubleTap(android.view.MotionEvent e)
onDoubleTap in interface android.view.GestureDetector.OnDoubleTapListenerpublic boolean onDoubleTapEvent(android.view.MotionEvent e)
onDoubleTapEvent in interface android.view.GestureDetector.OnDoubleTapListenerpublic boolean onDown(android.view.MotionEvent e)
onDown in interface android.view.GestureDetector.OnGestureListenerpublic void onShowPress(android.view.MotionEvent e)
onShowPress in interface android.view.GestureDetector.OnGestureListenerpublic boolean onSingleTapUp(android.view.MotionEvent e)
onSingleTapUp in interface android.view.GestureDetector.OnGestureListenerpublic boolean onScroll(android.view.MotionEvent e1,
android.view.MotionEvent e2,
float distanceX,
float distanceY)
onScroll in interface android.view.GestureDetector.OnGestureListenerpublic void onLongPress(android.view.MotionEvent e)
onLongPress in interface android.view.GestureDetector.OnGestureListenerpublic boolean onFling(android.view.MotionEvent e1,
android.view.MotionEvent e2,
float velocityX,
float velocityY)
onFling in interface android.view.GestureDetector.OnGestureListenerpublic boolean onRotate(RotateGestureDetector detector)
onRotate in interface RotateGestureDetector.OnRotateGestureListenerpublic boolean onRotateBegin(RotateGestureDetector detector)
onRotateBegin in interface RotateGestureDetector.OnRotateGestureListenerpublic void onRotateEnd(RotateGestureDetector detector)
onRotateEnd in interface RotateGestureDetector.OnRotateGestureListenerpublic boolean onScale(android.view.ScaleGestureDetector detector)
onScale in interface android.view.ScaleGestureDetector.OnScaleGestureListenerpublic boolean onScaleBegin(android.view.ScaleGestureDetector detector)
onScaleBegin in interface android.view.ScaleGestureDetector.OnScaleGestureListenerpublic void onScaleEnd(android.view.ScaleGestureDetector detector)
onScaleEnd in interface android.view.ScaleGestureDetector.OnScaleGestureListenerpublic boolean onShove(ShoveGestureDetector detector)
onShove in interface ShoveGestureDetector.OnShoveGestureListenerpublic boolean onShoveBegin(ShoveGestureDetector detector)
onShoveBegin in interface ShoveGestureDetector.OnShoveGestureListenerpublic void onShoveEnd(ShoveGestureDetector detector)
onShoveEnd in interface ShoveGestureDetector.OnShoveGestureListener