GestureEvent

public final class GestureEvent


Represents a gesture event that has occurred, containing information about the gesture action. This class encapsulates the data associated with a specific gesture, such as the type of gesture performed.

Summary

Nested types

@IntDef(value = )
@Retention(value = RetentionPolicy.SOURCE)
public annotation GestureEvent.Gesture

Defines the set of supported gesture types.

@IntDef(value = )
@Retention(value = RetentionPolicy.SOURCE)
public annotation GestureEvent.GestureAction

Defines the set of actions that can be associated with a gesture.

Defines the bitmask of reasons why gesture actions might be unavailable.

Constants

static final int

The dismiss action associated with a gesture.

static final int

The action to be used to invoke AI features.

static final int

The page backward gesture action.

static final int

The page forward gesture action.

static final int

The primary action associated with a gesture.

static final int

The select gesture action to confirm/select an item.

static final int

The sleep action to put the device into a sleeping state.

static final int

The wake up action to wake the device from sleep.

static final int

Gesture action is available and enabled.

static final int

Gesture action is unavailable because the watch is not being worn.

static final int

Gesture action is unavailable for unspecified or unknown reasons.

static final int

Gesture action is disabled in System Settings.

static final int

Phone GMS specific: Unavailable because the remote client is disconnected.

static final int

Bloom gesture: user opens and spreads all fingers outward from a closed 'bud' position.

static final int

Clench gesture: user rapidly and deliberately closes their hand into a tight fist.

static final int

Double knock: the user makes a fist and bends their wrist up and down twice.

static final int

A double pinch gesture: when a user performs quick back-to-back pinches.

static final int

Double shake: the user shakes their wrist quickly twice.

static final int

Double wrist turn gesture: the user performs the wrist turn gesture twice.

static final int

Knock: the user makes a fist and bends their wrist up and down.

static final int

Maximum value for gesture types.

static final int

The minimum value for a gesture.

static final int

Palm up clench gesture: palm faces upward, user closes hand into a tight fist.

static final int

Palm up double pinch gesture: palm faces upward, user performs back-to-back pinches.

static final int

Palm up single pinch gesture: palm faces upward, user performs a pinch.

static final int

Pinch and flick backward gesture: maintains pinch while flicking hand toward the body.

static final int

Pinch and flick forward gesture: maintains pinch while flicking hand away from body.

static final int

Pinch and hold: maintains pinch for a short duration.

static final int

Shake: the user quickly shakes their wrist by rotating it outward.

static final int

A single pinch gesture: the user performs a quick pinch.

static final int

Unknown gesture type.

static final int

A wrist turn gesture: when a user turns the watch-wearing wrist, such as by turning the wrist outside and back inside.

Public constructors

GestureEvent(
    @GestureEvent.GestureAction int gestureAction,
    @GestureEvent.Gesture int gesture
)

Constructs a new GestureEvent.

Public methods

static @NonNull String
boolean
static @NonNull String

Returns a String representing a given gesture, for logging and debugging.

int

Returns the gesture associated with this gesture event.

int

Returns the action associated with this gesture event.

int
String

Constants

ACTION_DISMISS

public static final int ACTION_DISMISS = 2

The dismiss action associated with a gesture.

ACTION_INVOKE_AI

public static final int ACTION_INVOKE_AI = 5

The action to be used to invoke AI features.

ACTION_PAGE_BACKWARD

public static final int ACTION_PAGE_BACKWARD = 8

The page backward gesture action.

ACTION_PAGE_FORWARD

public static final int ACTION_PAGE_FORWARD = 7

The page forward gesture action.

ACTION_PRIMARY

public static final int ACTION_PRIMARY = 1

The primary action associated with a gesture.

ACTION_SELECT

public static final int ACTION_SELECT = 6

The select gesture action to confirm/select an item.

ACTION_SLEEP

public static final int ACTION_SLEEP = 4

The sleep action to put the device into a sleeping state.

ACTION_WAKE

public static final int ACTION_WAKE = 3

The wake up action to wake the device from sleep.

FLAG_GESTURE_UNAVAILABILITY_REASON_NONE

public static final int FLAG_GESTURE_UNAVAILABILITY_REASON_NONE = 0

Gesture action is available and enabled.

FLAG_GESTURE_UNAVAILABILITY_REASON_OFF_BODY

public static final int FLAG_GESTURE_UNAVAILABILITY_REASON_OFF_BODY = 4

Gesture action is unavailable because the watch is not being worn.

FLAG_GESTURE_UNAVAILABILITY_REASON_UNKNOWN

public static final int FLAG_GESTURE_UNAVAILABILITY_REASON_UNKNOWN = 1

Gesture action is unavailable for unspecified or unknown reasons.

FLAG_GESTURE_UNAVAILABILITY_REASON_USER_SETTING

public static final int FLAG_GESTURE_UNAVAILABILITY_REASON_USER_SETTING = 2

Gesture action is disabled in System Settings.

FLAG_GESTURE_UNAVAILABILITY_REASON_WATCH_DISCONNECTED

public static final int FLAG_GESTURE_UNAVAILABILITY_REASON_WATCH_DISCONNECTED = 8

Phone GMS specific: Unavailable because the remote client is disconnected.

GESTURE_BLOOM

public static final int GESTURE_BLOOM = 7

Bloom gesture: user opens and spreads all fingers outward from a closed 'bud' position.

GESTURE_CLENCH

public static final int GESTURE_CLENCH = 8

Clench gesture: user rapidly and deliberately closes their hand into a tight fist.

GESTURE_DOUBLE_KNOCK

public static final int GESTURE_DOUBLE_KNOCK = 14

Double knock: the user makes a fist and bends their wrist up and down twice.

GESTURE_DOUBLE_PINCH

public static final int GESTURE_DOUBLE_PINCH = 1

A double pinch gesture: when a user performs quick back-to-back pinches.

GESTURE_DOUBLE_SHAKE

public static final int GESTURE_DOUBLE_SHAKE = 16

Double shake: the user shakes their wrist quickly twice.

GESTURE_DOUBLE_WRIST_TURN

public static final int GESTURE_DOUBLE_WRIST_TURN = 6

Double wrist turn gesture: the user performs the wrist turn gesture twice.

GESTURE_KNOCK

public static final int GESTURE_KNOCK = 13

Knock: the user makes a fist and bends their wrist up and down.

GESTURE_MAX

public static final int GESTURE_MAX = 16

Maximum value for gesture types.

GESTURE_MIN

public static final int GESTURE_MIN = 1

The minimum value for a gesture.

GESTURE_PALM_UP_CLENCH

public static final int GESTURE_PALM_UP_CLENCH = 9

Palm up clench gesture: palm faces upward, user closes hand into a tight fist.

GESTURE_PALM_UP_DOUBLE_PINCH

public static final int GESTURE_PALM_UP_DOUBLE_PINCH = 5

Palm up double pinch gesture: palm faces upward, user performs back-to-back pinches.

GESTURE_PALM_UP_SINGLE_PINCH

public static final int GESTURE_PALM_UP_SINGLE_PINCH = 4

Palm up single pinch gesture: palm faces upward, user performs a pinch.

GESTURE_PINCH_AND_FLICK_BACKWARD

public static final int GESTURE_PINCH_AND_FLICK_BACKWARD = 11

Pinch and flick backward gesture: maintains pinch while flicking hand toward the body.

GESTURE_PINCH_AND_FLICK_FORWARD

public static final int GESTURE_PINCH_AND_FLICK_FORWARD = 10

Pinch and flick forward gesture: maintains pinch while flicking hand away from body.

GESTURE_PINCH_AND_HOLD

public static final int GESTURE_PINCH_AND_HOLD = 12

Pinch and hold: maintains pinch for a short duration.

GESTURE_SHAKE

public static final int GESTURE_SHAKE = 15

Shake: the user quickly shakes their wrist by rotating it outward.

GESTURE_SINGLE_PINCH

public static final int GESTURE_SINGLE_PINCH = 3

A single pinch gesture: the user performs a quick pinch.

GESTURE_UNKNOWN

public static final int GESTURE_UNKNOWN = -1

Unknown gesture type.

GESTURE_WRIST_TURN

public static final int GESTURE_WRIST_TURN = 2

A wrist turn gesture: when a user turns the watch-wearing wrist, such as by turning the wrist outside and back inside.

Public fields

gesture

@GestureEvent.Gesture
public final int gesture

gestureAction

@GestureEvent.GestureAction
public final int gestureAction

Public constructors

GestureEvent

public GestureEvent(
    @GestureEvent.GestureAction int gestureAction,
    @GestureEvent.Gesture int gesture
)

Constructs a new GestureEvent.

Parameters
@GestureEvent.GestureAction int gestureAction

The action performed, as defined by GestureAction.

@GestureEvent.Gesture int gesture

The gesture that was performed, as defined by Gesture.

Public methods

actionToString

public static @NonNull String actionToString(@GestureEvent.GestureAction int action)

equals

public boolean equals(@Nullable Object o)

gestureToString

public static @NonNull String gestureToString(@GestureEvent.Gesture int gesture)

Returns a String representing a given gesture, for logging and debugging.

getGesture

@GestureEvent.Gesture
public int getGesture()

Returns the gesture associated with this gesture event.

Returns
int

The gesture.

getGestureAction

@GestureEvent.GestureAction
public int getGestureAction()

Returns the action associated with this gesture event.

Returns
int

The gesture action.

hashCode

public int hashCode()

toString

public String toString()