Skip to content
com.iristick.smartglass.core

Class TouchEvent


public abstract class TouchEvent
extends Object
This class represents an event from the touchpad.

To receive such events, implement the TouchEvent.Callback interface and pass it to Headset.registerTouchEventCallback(com.iristick.smartglass.core.TouchEvent.Callback, android.os.Handler, int).

Nested Class Summary

Modifier and Type Class and Description
static interface  TouchEvent.Callback
Callback interface for touchpad events.

Field Summary

Modifier and Type Field and Description
static int GESTURE_DOUBLE_TAP
Gesture code for a double tap.
static int GESTURE_ENTER
Gesture code for starting touching the touchpad.
static int GESTURE_EXIT
Gesture code for ending touching the touchpad.
static int GESTURE_LONG_TAP
Gesture code for a long tap.
static int GESTURE_NONE
Unknown gesture event.
static int GESTURE_SWIPE_BACKWARD
Gesture code for swiping backwards, towards the user head.
static int GESTURE_SWIPE_DOWN
Gesture code for swiping down to the ground.
static int GESTURE_SWIPE_FORWARD
Gesture code for swiping forward in the user looking direction.
static int GESTURE_TAP
Gesture code for a single tap.
static int GESTURE_TAP_UNCONFIRMED
Gesture code for an unconfirmed tap, i.e., a tap that might be the first tap of a double tap.

Constructor Summary

Constructor and Description
TouchEvent() 

Method Summary

Modifier and Type Method and Description
abstract int getGestureCode()
Retrieve the gesture code of the event.
abstract MotionEvent getMotionEvent()
Retrieve the MotionEvent of the event.

Methods inherited from class java.lang.Object

equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Field Detail

GESTURE_NONE

public static final int GESTURE_NONE
Unknown gesture event.

GESTURE_SWIPE_FORWARD

public static final int GESTURE_SWIPE_FORWARD
Gesture code for swiping forward in the user looking direction.

GESTURE_SWIPE_BACKWARD

public static final int GESTURE_SWIPE_BACKWARD
Gesture code for swiping backwards, towards the user head.

GESTURE_SWIPE_DOWN

public static final int GESTURE_SWIPE_DOWN
Gesture code for swiping down to the ground.

GESTURE_TAP

public static final int GESTURE_TAP
Gesture code for a single tap.

GESTURE_DOUBLE_TAP

public static final int GESTURE_DOUBLE_TAP
Gesture code for a double tap.

GESTURE_LONG_TAP

public static final int GESTURE_LONG_TAP
Gesture code for a long tap.

GESTURE_ENTER

public static final int GESTURE_ENTER
Gesture code for starting touching the touchpad.

GESTURE_EXIT

public static final int GESTURE_EXIT
Gesture code for ending touching the touchpad.

GESTURE_TAP_UNCONFIRMED

public static final int GESTURE_TAP_UNCONFIRMED
Gesture code for an unconfirmed tap, i.e., a tap that might be the first tap of a double tap. Use this code instead of GESTURE_TAP if you do not handle double taps.

Constructor Detail

TouchEvent

public TouchEvent()

Method Detail

getGestureCode

@CheckResult
public abstract int getGestureCode()
Retrieve the gesture code of the event.
Returns:
The gesture code or GESTURE_NONE if no gesture was detected.

getMotionEvent

@CheckResult
 @Nullable
public abstract MotionEvent getMotionEvent()
Retrieve the MotionEvent of the event.

The MotionEvent is relative to the size of the touchpad, meaning that the values along the X and Y axis range from 0.0f to 1.0f with (0, 0) being the lower left corner of the touchpad and (1, 1) the upper right corner.

Returns:
The motion event or null if there was no motion data.