BackgroundComplicationTapFilter


Note: As of July 10, 2024, watch faces must use the Watch Face Format in order to be installed on new watches that launch with Wear OS 5 pre-installed. Learn more about the user-facing changes in this Help Center article.

Additionally, starting in early 2025 (specific date to be announced during Q4 2024), all new watch faces published on Google Play must use the Watch Face Format.

public final class BackgroundComplicationTapFilter implements ComplicationTapFilter


Default ComplicationTapFilter for ComplicationSlotBoundsType.BACKGROUND complicationSlots.

Summary

Public constructors

Public methods

boolean
hitTest(
    @NonNull ComplicationSlot complicationSlot,
    @NonNull Rect screenBounds,
    @Px int x,
    @Px int y,
    boolean includeMargins
)

Performs a hit test, returning true if the supplied coordinates in pixels are within the the provided complicationSlot scaled to screenBounds.

Inherited methods

From androidx.wear.watchface.ComplicationTapFilter
boolean
hitTest(
    @NonNull ComplicationSlot complicationSlot,
    @NonNull Rect screenBounds,
    @Px int x,
    @Px int y
)

This method is deprecated. hitTest without specifying includeMargins is deprecated

Public constructors

BackgroundComplicationTapFilter

Added in 1.0.0
public BackgroundComplicationTapFilter()

Public methods

hitTest

public boolean hitTest(
    @NonNull ComplicationSlot complicationSlot,
    @NonNull Rect screenBounds,
    @Px int x,
    @Px int y,
    boolean includeMargins
)

Performs a hit test, returning true if the supplied coordinates in pixels are within the the provided complicationSlot scaled to screenBounds.

Parameters
@NonNull ComplicationSlot complicationSlot

The ComplicationSlot to perform a hit test for.

@NonNull Rect screenBounds

A Rect describing the bounds of the display.

@Px int x

The screen space X coordinate in pixels.

@Px int y

The screen space Y coordinate in pixels.

boolean includeMargins

Whether or not the margins should be included