HapticFeedbackConstantsCompat


public final class HapticFeedbackConstantsCompat


Helper class for accessing values in android.view.HapticFeedbackConstants.

Summary

Constants

static final int

The user has pressed either an hour or minute tick of a Clock.

static final int
CONFIRM = 16

A haptic effect to signal the confirmation or successful completion of a user interaction.

static final int

The user has performed a context click on an object.

static final int

The user has started a drag-and-drop gesture.

static final int

Flag for performHapticFeedback: Ignore the setting in the view for whether to perform haptic feedback, do it always.

static final int

The user has finished a gesture (e.g. on the soft keyboard).

static final int

The user has started a gesture (e.g. on the soft keyboard).

static final int

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is “eligible” at a certain threshold of movement, and can be cancelled by moving back past the threshold.

static final int

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is “eligible” at a certain threshold of movement, and can be cancelled by moving back past the threshold.

static final int

The user has pressed a virtual or software keyboard key.

static final int

The user has released a virtual keyboard key.

static final int

The user has pressed a soft keyboard key.

static final int

The user has performed a long press on an object that is resulting in an action being performed.

static final int

No haptic feedback should be performed.

static final int
REJECT = 17

A haptic effect to signal the rejection or failure of a user interaction.

static final int

The user is switching between a series of many potential choices, for example minutes on a clock face, or individual percentages.

static final int

The user is switching between a series of potential choices, for example items in a list or discrete points on a slider.

static final int

The user has performed a selection/insertion handle move on text field.

static final int

The user has toggled a switch or button into the off position.

static final int

The user has toggled a switch or button into the on position.

static final int

The user has pressed on a virtual on-screen key.

static final int

The user has released a virtual key.

Constants

CLOCK_TICK

Added in 1.11.0
public static final int CLOCK_TICK = 4

The user has pressed either an hour or minute tick of a Clock.

Compatibility:

  • API <21: No-op

CONFIRM

Added in 1.11.0
public static final int CONFIRM = 16

A haptic effect to signal the confirmation or successful completion of a user interaction.

Compatibility:

  • API <30: Same feedback as VIRTUAL_KEY

CONTEXT_CLICK

Added in 1.11.0
public static final int CONTEXT_CLICK = 6

The user has performed a context click on an object.

Compatibility:

  • API <23: Same feedback as CLOCK_TICK
  • API <21: No-op

DRAG_START

Added in 1.11.0
public static final int DRAG_START = 25

The user has started a drag-and-drop gesture. The drag target has just been "picked up".

Compatibility:

  • API <34: Same feedback as LONG_PRESS

FLAG_IGNORE_VIEW_SETTING

Added in 1.11.0
public static final int FLAG_IGNORE_VIEW_SETTING = 1

Flag for performHapticFeedback: Ignore the setting in the view for whether to perform haptic feedback, do it always.

GESTURE_END

Added in 1.11.0
public static final int GESTURE_END = 13

The user has finished a gesture (e.g. on the soft keyboard).

Compatibility:

  • API <30: Same feedback as CONTEXT_CLICK
  • API <21: No-op

GESTURE_START

Added in 1.11.0
public static final int GESTURE_START = 12

The user has started a gesture (e.g. on the soft keyboard).

Compatibility:

  • API <30: Same feedback as VIRTUAL_KEY

GESTURE_THRESHOLD_ACTIVATE

Added in 1.11.0
public static final int GESTURE_THRESHOLD_ACTIVATE = 23

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is “eligible” at a certain threshold of movement, and can be cancelled by moving back past the threshold. This constant indicates that the user's motion has just passed the threshold for the action to be activated on release.

See also
GESTURE_THRESHOLD_DEACTIVATE

Compatibility:

  • API <34: Same feedback as CONTEXT_CLICK
  • API <21: No-op

GESTURE_THRESHOLD_DEACTIVATE

Added in 1.11.0
public static final int GESTURE_THRESHOLD_DEACTIVATE = 24

The user is executing a swipe/drag-style gesture, such as pull-to-refresh, where the gesture action is “eligible” at a certain threshold of movement, and can be cancelled by moving back past the threshold. This constant indicates that the user's motion has just re-crossed back "under" the threshold for the action to be activated, meaning the gesture is currently in a cancelled state.

See also
GESTURE_THRESHOLD_ACTIVATE

Compatibility:

  • API <34: Same feedback as CLOCK_TICK
  • API <21: No-op

KEYBOARD_PRESS

Added in 1.11.0
public static final int KEYBOARD_PRESS = 3

The user has pressed a virtual or software keyboard key.

Compatibility:

  • API <27: Same feedback as KEYBOARD_TAP

KEYBOARD_RELEASE

Added in 1.11.0
public static final int KEYBOARD_RELEASE = 7

The user has released a virtual keyboard key.

Compatibility:

  • API <27: No-op

KEYBOARD_TAP

Added in 1.11.0
public static final int KEYBOARD_TAP = 3

The user has pressed a soft keyboard key.

LONG_PRESS

Added in 1.11.0
public static final int LONG_PRESS = 0

The user has performed a long press on an object that is resulting in an action being performed.

NO_HAPTICS

Added in 1.11.0
public static final int NO_HAPTICS = -1

No haptic feedback should be performed. Applications may use this value to indicate skipping a call to performHapticFeedback entirely, or else rely that it will immediately return false.

Compatibility:

  • API <34: Same behavior, immediately returns false

REJECT

Added in 1.11.0
public static final int REJECT = 17

A haptic effect to signal the rejection or failure of a user interaction.

Compatibility:

  • API <30: Same feedback as LONG_PRESS

SEGMENT_FREQUENT_TICK

Added in 1.11.0
public static final int SEGMENT_FREQUENT_TICK = 27

The user is switching between a series of many potential choices, for example minutes on a clock face, or individual percentages. This constant is expected to be very soft, so as not to be uncomfortable when performed a lot in quick succession. If the device can’t make a suitably soft vibration, then it may not make any vibration.

Some specializations of this constant exist for specific actions, notably CLOCK_TICK and TEXT_HANDLE_MOVE.

See also SEGMENT_TICK.

Compatibility:

  • API <34: Same feedback as CLOCK_TICK
  • API <21: No-op

SEGMENT_TICK

Added in 1.11.0
public static final int SEGMENT_TICK = 26

The user is switching between a series of potential choices, for example items in a list or discrete points on a slider.

See also SEGMENT_FREQUENT_TICK for cases where density of choices is high, and the haptics should be lighter or suppressed for a better user experience.

Compatibility:

  • API <34: Same feedback as CONTEXT_CLICK
  • API <21: No-op

TEXT_HANDLE_MOVE

Added in 1.11.0
public static final int TEXT_HANDLE_MOVE = 9

The user has performed a selection/insertion handle move on text field.

Compatibility:

  • API <27: No-op

TOGGLE_OFF

Added in 1.11.0
public static final int TOGGLE_OFF = 22

The user has toggled a switch or button into the off position.

Compatibility:

  • API <34: Same feedback as CLOCK_TICK
  • API <21: No-op

TOGGLE_ON

Added in 1.11.0
public static final int TOGGLE_ON = 21

The user has toggled a switch or button into the on position.

Compatibility:

  • API <34: Same feedback as CONTEXT_CLICK
  • API <21: No-op

VIRTUAL_KEY

Added in 1.11.0
public static final int VIRTUAL_KEY = 1

The user has pressed on a virtual on-screen key.

VIRTUAL_KEY_RELEASE

Added in 1.11.0
public static final int VIRTUAL_KEY_RELEASE = 8

The user has released a virtual key.

Compatibility:

  • API <27: No-op