WatchFace.TapListener
public interface WatchFace.TapListener
Listens for taps on the watchface.
Summary
Public methods |
|
|---|---|
abstract void |
@UiThreadThis method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public methods
onTapEvent
@UiThread
abstract voidonTapEvent(
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.DOWNwhen the user puts the finger down on the touchscreen -
TapType.UPwhen the user lifts the finger from the touchscreen -
TapType.CANCELwhen 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 |
ComplicationSlot complicationSlot |
The |