SimpleOnGestureListener
open class SimpleOnGestureListener : GestureDetector.OnContextClickListener, GestureDetector.OnDoubleTapListener, GestureDetector.OnGestureListener
| kotlin.Any | |
| ↳ | android.view.GestureDetector.SimpleOnGestureListener | 
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
| Public constructors | |
|---|---|
| Public methods | |
|---|---|
| open Boolean | Notified when a context click occurs. | 
| open Boolean | Notified when a double-tap occurs. | 
| open Boolean | Notified when an event within a double-tap gesture occurs, including the down, move, and up events. | 
| open Boolean | onDown(e: MotionEvent)Notified when a tap occurs with the down  | 
| open Boolean | onFling(e1: MotionEvent?, e2: MotionEvent, velocityX: Float, velocityY: Float)Notified of a fling event when it occurs with the initial on down  | 
| open Unit | Notified when a long press occurs with the initial on down  | 
| open Boolean | onScroll(e1: MotionEvent?, e2: MotionEvent, distanceX: Float, distanceY: Float)Notified when a scroll occurs with the initial on down  | 
| open Unit | The user has performed a down  | 
| open Boolean | Notified when a single-tap occurs. | 
| open Boolean | Notified when a tap occurs with the up  | 
Public constructors
SimpleOnGestureListener
SimpleOnGestureListener()
Public methods
onContextClick
open fun onContextClick(e: MotionEvent): Boolean
Notified when a context click occurs.
| Parameters | |
|---|---|
| e | MotionEvent: This value cannot be null. | 
| Return | |
|---|---|
| Boolean | true if the event is consumed, else false | 
onDoubleTap
open fun onDoubleTap(e: MotionEvent): Boolean
Notified when a double-tap occurs. Triggered on the down event of second tap.
| Parameters | |
|---|---|
| e | MotionEvent: This value cannot be null. | 
| Return | |
|---|---|
| Boolean | true if the event is consumed, else false | 
onDoubleTapEvent
open fun onDoubleTapEvent(e: MotionEvent): Boolean
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. | 
| Return | |
|---|---|
| Boolean | true if the event is consumed, else false | 
onDown
open fun onDown(e: MotionEvent): Boolean
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
open fun onFling(
e1: MotionEvent?,
e2: MotionEvent,
velocityX: Float,
velocityY: Float
): Boolean
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. | 
| Return | |
|---|---|
| Boolean | true if the event is consumed, else false | 
onLongPress
open fun onLongPress(e: MotionEvent): Unit
Notified when a long press occurs with the initial on down MotionEvent that trigged it.
| Parameters | |
|---|---|
| e | MotionEvent: This value cannot be null. | 
onScroll
open fun onScroll(
e1: MotionEvent?,
e2: MotionEvent,
distanceX: Float,
distanceY: Float
): Boolean
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 e1ande2. | 
| distanceY | Float: The distance along the Y axis that has been scrolled since the last call to onScroll. This is NOT the distance between e1ande2. | 
| Return | |
|---|---|
| Boolean | true if the event is consumed, else false | 
onShowPress
open fun onShowPress(e: MotionEvent): Unit
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
open fun onSingleTapConfirmed(e: MotionEvent): Boolean
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. | 
| Return | |
|---|---|
| Boolean | true if the event is consumed, else false | 
onSingleTapUp
open fun onSingleTapUp(e: MotionEvent): Boolean
Notified when a tap occurs with the up MotionEvent that triggered it.
| Parameters | |
|---|---|
| e | MotionEvent: This value cannot be null. | 
| Return | |
|---|---|
| Boolean | true if the event is consumed, else false | 
