# ComplicationSlotsManager

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/ComplicationSlotsManager.kt+class:androidx.wear.watchface.ComplicationSlotsManager) 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 final class ComplicationSlotsManager
```

<br />

*** ** * ** ***

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

The `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`s associated with the `https://developer.android.com/reference/androidx/wear/watchface/WatchFace`. Dynamic creation of ComplicationSlots isn't supported, however complicationSlots can be enabled and disabled by `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting`.

use Watch Face Format instead

## Summary

| ### Nested types |
|---|
| `public interface https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager.TapCallback` **This interface is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public constructors |
|---|
| `[ComplicationSlotsManager](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#ComplicationSlotsManager(kotlin.collections.Collection,androidx.wear.watchface.style.CurrentUserStyleRepository))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot> complicationSlotCollection, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/CurrentUserStyleRepository currentUserStyleRepository )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

| ### Public methods |
|---|---|
| `final void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [addTapListener](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#addTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager.TapCallback tapCallback )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `boolean` | `[equals](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#equals(kotlin.Any))(https://developer.android.com/reference/java/lang/Object.html other)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` | `[get](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#get(kotlin.Int))(int id)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` | `[getBackgroundComplicationSlot](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getBackgroundComplicationSlot())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` | `[getComplicationSlotAt](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getComplicationSlotAt(kotlin.Int,kotlin.Int))(@https://developer.android.com/reference/androidx/annotation/Px int x, @https://developer.android.com/reference/androidx/annotation/Px int y)` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot>` | `[getComplicationSlots](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getComplicationSlots())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Map.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/lang/Integer.html, @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/TapEvent>` | `[getLastComplicationTapDownEvents](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getLastComplicationTapDownEvents())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `int` | `[hashCode](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#hashCode())()` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `final void` | `@https://developer.android.com/reference/androidx/annotation/UiThread [removeTapListener](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#removeTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))( @https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager.TapCallback tapCallback )` **This method is deprecated.** AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

## Public constructors

### ComplicationSlotsManager

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 [ComplicationSlotsManager](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#ComplicationSlotsManager(kotlin.collections.Collection,androidx.wear.watchface.style.CurrentUserStyleRepository))(
    @NonNull Collection<@NonNull ComplicationSlot> complicationSlotCollection,
    @NonNull CurrentUserStyleRepository currentUserStyleRepository
)
```

> [!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

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/java/util/Collection.html<@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot> complicationSlotCollection` | The `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot`s associated with the watch face, may be empty. |
| `@https://developer.android.com/reference/androidx/annotation/NonNull https://developer.android.com/reference/androidx/wear/watchface/style/CurrentUserStyleRepository currentUserStyleRepository` | The `https://developer.android.com/reference/androidx/wear/watchface/style/CurrentUserStyleRepository` used to listen for `https://developer.android.com/reference/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting` changes and apply them. |

## Public methods

### addTapListener

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)

```
@UiThread
public final void [addTapListener](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#addTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))(
    @NonNull ComplicationSlotsManager.TapCallback tapCallback
)
```

> [!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

Adds a `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager.TapCallback` which is called whenever the user interacts with a complication slot.

### equals

```
public boolean [equals](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#equals(kotlin.Any))(Object other)
```

> [!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

### get

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 final ComplicationSlot [get](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#get(kotlin.Int))(int id)
```

> [!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

Returns the `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` corresponding to `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#get(kotlin.Int)`, if there is one, or `null`.

### getBackgroundComplicationSlot

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 final ComplicationSlot [getBackgroundComplicationSlot](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getBackgroundComplicationSlot())()
```

> [!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

Returns the background `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` if there is one or `null` otherwise.

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` | The background `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` if there is one or `null` otherwise |

### getComplicationSlotAt

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 final ComplicationSlot [getComplicationSlotAt](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getComplicationSlotAt(kotlin.Int,kotlin.Int))(@Px int x, @Px int y)
```

> [!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

Returns the id of the complication slot at coordinates x, y or `null` if there isn't one. Initially checks slots without margins (should be no overlaps) then then if there was no hit it tries again this time with margins (overlaps are possible) reporting the first hit if any.

| Parameters |
|---|---|
| `@https://developer.android.com/reference/androidx/annotation/Px int x` | The x coordinate of the point to perform a hit test |
| `@https://developer.android.com/reference/androidx/annotation/Px int y` | The y coordinate of the point to perform a hit test |

| Returns |
|---|---|
| `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` | The `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` at coordinates x, y or {@code null} if there isn't one |

### getComplicationSlots

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 final @NonNull Map<@NonNull Integer, @NonNull ComplicationSlot> [getComplicationSlots](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getComplicationSlots())()
```

> [!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

A map of complication IDs to complicationSlots.

### getLastComplicationTapDownEvents

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 final @NonNull Map<@NonNull Integer, @NonNull TapEvent> [getLastComplicationTapDownEvents](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#getLastComplicationTapDownEvents())()
```

> [!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

Map of `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlot` id to the latest `https://developer.android.com/reference/androidx/wear/watchface/TapEvent` that the ComplicationSlot received, if any.

### hashCode

```
public int [hashCode](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#hashCode())()
```

> [!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

### removeTapListener

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)

```
@UiThread
public final void [removeTapListener](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#removeTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))(
    @NonNull ComplicationSlotsManager.TapCallback tapCallback
)
```

> [!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

Removes a `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager.TapCallback` previously added by `https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager#addTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback)`.