WatchFace.TapListener

public interface WatchFace.TapListener


Listens for taps on the watchface.

Summary

Public methods

abstract void
@UiThread
onTapEvent(
    int tapType,
    @NonNull TapEvent tapEvent,
    ComplicationSlot complicationSlot
)

Called whenever the user taps on the watchface.

Public methods

onTapEvent

Added in 1.0.0
@UiThread
abstract void onTapEvent(
    int tapType,
    @NonNull TapEvent tapEvent,
    ComplicationSlot complicationSlot
)

Called whenever the user taps on the watchface.

The watch face receives three different types of touch events:

  • TapType.DOWN when the user puts the finger down on the touchscreen

  • TapType.UP when the user lifts the finger from the touchscreen

  • TapType.CANCEL when the system detects that the user is performing a gesture other than a tap

Note that the watch face is only given tap events, i.e., events where the user puts the finger down on the screen and then lifts it at the position. If the user performs any other type of gesture while their finger in on the touchscreen, the watch face will be receive a cancel, as all other gestures are reserved by the system.

Therefore, a TapType.DOWN event and the successive TapType.UP event are guaranteed to be close enough to be considered a tap according to the value returned by android.view.ViewConfiguration.getScaledTouchSlop.

If the watch face receives a TapType.CANCEL event, it should not trigger any action, as the system is already processing the gesture.

Parameters
int tapType

The type of touch event sent to the watch face

@NonNull TapEvent tapEvent

The received TapEvent

ComplicationSlot complicationSlot

The ComplicationSlot tapped if any or null otherwise