GestureDetector.SimpleOnGestureListener
public
static
class
GestureDetector.SimpleOnGestureListener
extends Object
implements
GestureDetector.OnContextClickListener,
GestureDetector.OnDoubleTapListener,
GestureDetector.OnGestureListener
A convenience class to extend when you only want to listen for a subset
of all the gestures. This implements all methods in the
OnGestureListener
, OnDoubleTapListener
, and OnContextClickListener
but does nothing and return false
for all applicable methods.
Summary
Inherited methods |
From class
java.lang.Object
Object
|
clone()
Creates and returns a copy of this object.
|
boolean
|
equals(Object obj)
Indicates whether some other object is "equal to" this one.
|
void
|
finalize()
Called by the garbage collector on an object when garbage collection
determines that there are no more references to the object.
|
final
Class<?>
|
getClass()
Returns the runtime class of this Object .
|
int
|
hashCode()
Returns a hash code value for the object.
|
final
void
|
notify()
Wakes up a single thread that is waiting on this object's
monitor.
|
final
void
|
notifyAll()
Wakes up all threads that are waiting on this object's monitor.
|
String
|
toString()
Returns a string representation of the object.
|
final
void
|
wait(long timeoutMillis, int nanos)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait(long timeoutMillis)
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted, or until a
certain amount of real time has elapsed.
|
final
void
|
wait()
Causes the current thread to wait until it is awakened, typically
by being notified or interrupted.
|
|
From interface
android.view.GestureDetector.OnContextClickListener
|
From interface
android.view.GestureDetector.OnDoubleTapListener
|
From interface
android.view.GestureDetector.OnGestureListener
|
Public constructors
SimpleOnGestureListener
public SimpleOnGestureListener ()
Public methods
onContextClick
public boolean onContextClick (MotionEvent e)
Notified when a context click occurs.
Parameters |
e |
MotionEvent : This value cannot be null . |
Returns |
boolean |
true if the event is consumed, else false |
onDoubleTap
public boolean onDoubleTap (MotionEvent e)
Notified when a double-tap occurs. Triggered on the down event of second tap.
Parameters |
e |
MotionEvent : This value cannot be null . |
Returns |
boolean |
true if the event is consumed, else false |
onDoubleTapEvent
public boolean onDoubleTapEvent (MotionEvent e)
Notified when an event within a double-tap gesture occurs, including
the down, move, and up events.
Parameters |
e |
MotionEvent : This value cannot be null . |
Returns |
boolean |
true if the event is consumed, else false |
onDown
public boolean onDown (MotionEvent e)
Notified when a tap occurs with the down MotionEvent
that triggered it. This will be triggered immediately for
every down event. All other events should be preceded by this.
Parameters |
e |
MotionEvent : This value cannot be null . |
onFling
public boolean onFling (MotionEvent e1,
MotionEvent e2,
float velocityX,
float velocityY)
Notified of a fling event when it occurs with the initial on down MotionEvent
and the matching up MotionEvent
. The calculated velocity is supplied along
the x and y axis in pixels per second.
Parameters |
e1 |
MotionEvent : This value may be null . |
e2 |
MotionEvent : This value cannot be null . |
velocityX |
float : The velocity of this fling measured in pixels per second
along the x axis. |
velocityY |
float : The velocity of this fling measured in pixels per second
along the y axis. |
Returns |
boolean |
true if the event is consumed, else false |
onLongPress
public void onLongPress (MotionEvent e)
Notified when a long press occurs with the initial on down MotionEvent
that trigged it.
Parameters |
e |
MotionEvent : This value cannot be null . |
public boolean onScroll (MotionEvent e1,
MotionEvent e2,
float distanceX,
float distanceY)
Notified when a scroll occurs with the initial on down MotionEvent
and the
current move MotionEvent
. The distance in x and y is also supplied for
convenience.
Parameters |
e1 |
MotionEvent : This value may be null . |
e2 |
MotionEvent : This value cannot be null . |
distanceX |
float : The distance along the X axis that has been scrolled since the last
call to onScroll. This is NOT the distance between e1
and e2 . |
distanceY |
float : The distance along the Y axis that has been scrolled since the last
call to onScroll. This is NOT the distance between e1
and e2 . |
Returns |
boolean |
true if the event is consumed, else false |
onShowPress
public void onShowPress (MotionEvent e)
The user has performed a down MotionEvent
and not performed
a move or up yet. This event is commonly used to provide visual
feedback to the user to let them know that their action has been
recognized i.e. highlight an element.
Parameters |
e |
MotionEvent : This value cannot be null . |
onSingleTapConfirmed
public boolean onSingleTapConfirmed (MotionEvent e)
Notified when a single-tap occurs.
Unlike OnGestureListener.onSingleTapUp(MotionEvent)
, this
will only be called after the detector is confident that the user's
first tap is not followed by a second tap leading to a double-tap
gesture.
Parameters |
e |
MotionEvent : This value cannot be null . |
Returns |
boolean |
true if the event is consumed, else false |
onSingleTapUp
public boolean onSingleTapUp (MotionEvent e)
Notified when a tap occurs with the up MotionEvent
that triggered it.
Parameters |
e |
MotionEvent : This value cannot be null . |
Returns |
boolean |
true if the event is consumed, else false |