# ComplicationTapFilter

Artifact: [androidx.wear.watchface:watchface](https://developer.android.com/jetpack/androidx/releases/wear-watchface) [View Source](https://cs.android.com/search?q=file:androidx/wear/watchface/ComplicationSlot.kt+class:androidx.wear.watchface.ComplicationTapFilter) Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

*** ** * ** ***


```
public interface ComplicationTapFilter
```

<br />

Known direct subclasses [BackgroundComplicationTapFilter](https://developer.android.com/reference/androidx/wear/watchface/BackgroundComplicationTapFilter), [RoundRectComplicationTapFilter](https://developer.android.com/reference/androidx/wear/watchface/RoundRectComplicationTapFilter)

|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/BackgroundComplicationTapFilter` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `https://developer.android.com/reference/androidx/wear/watchface/RoundRectComplicationTapFilter` | **This class is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

*** ** * ** ***

> [!CAUTION]
> **This interface is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Interface for determining whether a tap hits a complication.

use Watch Face Format instead

## Summary

| ### Public methods |
|---|---|
| `default boolean` | `[hitTest](https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot complicationSlot, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html screenBounds, @https://developer.android.com/reference/androidx/annotation/Px int x, @https://developer.android.com/reference/androidx/annotation/Px int y )` **This method is deprecated.** hitTest without specifying includeMargins is deprecated |
| `default boolean` | `[hitTest](https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot complicationSlot, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html screenBounds, @https://developer.android.com/reference/androidx/annotation/Px int x, @https://developer.android.com/reference/androidx/annotation/Px int y, boolean includeMargins )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Public methods

### hitTest

Added in [1.0.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.0.0) Deprecated in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0)

```
default boolean [hitTest](https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int))(
    @NonNull ComplicationSlot complicationSlot,
    @NonNull Rect screenBounds,
    @Px int x,
    @Px int y
)
```

> [!CAUTION]
> **This method is deprecated.**   
> hitTest without specifying includeMargins is deprecated, use this instead:
>
> ```
> hitTest(ComplicationSlot, Rect, Int, Int, Boolean)
> ```

Performs a hit test, returning `true` if the supplied coordinates in pixels are within the the provided `https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int)` scaled to `https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot complicationSlot` | The `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` to perform a hit test for. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html screenBounds` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bounds of the display. |
| `@https://developer.android.com/reference/androidx/annotation/Px int x` | The screen space X coordinate in pixels. |
| `@https://developer.android.com/reference/androidx/annotation/Px int y` | The screen space Y coordinate in pixels. |

### hitTest

Added in [1.2.0](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.2.0) Deprecated in [1.3.0-alpha07](https://developer.android.com/jetpack/androidx/releases/wear-watchface#1.3.0-alpha07)

```
default boolean [hitTest](https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean))(
    @NonNull ComplicationSlot complicationSlot,
    @NonNull Rect screenBounds,
    @Px int x,
    @Px int y,
    boolean includeMargins
)
```

> [!CAUTION]
> **This method is deprecated.**   
> AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff

Performs a hit test, returning `true` if the supplied coordinates in pixels are within the the provided `https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean)` scaled to `https://developer.android.com/reference/androidx/wear/watchface/ComplicationTapFilter#hitTest(androidx.wear.watchface.ComplicationSlot,android.graphics.Rect,kotlin.Int,kotlin.Int,kotlin.Boolean)`.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot complicationSlot` | The `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` to perform a hit test for. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/android/graphics/Rect.html screenBounds` | A `https://developer.android.com/reference/android/graphics/Rect.html` describing the bounds of the display. |
| `@https://developer.android.com/reference/androidx/annotation/Px int x` | The screen space X coordinate in pixels. |
| `@https://developer.android.com/reference/androidx/annotation/Px int y` | The screen space Y coordinate in pixels. |
| `boolean includeMargins` | Whether or not the margins should be included |