# ComplicationSlotsManager

# 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)

*** ** * ** ***

Kotlin\|[Java](https://developer.android.com/reference/androidx/wear/watchface/ComplicationSlotsManager "View this page in Java")

<br />

```
class ComplicationSlotsManager
```

<br />

*** ** * ** ***

| **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[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)s associated with the[WatchFace](https://developer.android.com/reference/kotlin/androidx/wear/watchface/WatchFace). Dynamic creation of ComplicationSlots isn't supported, however complicationSlots can be enabled and disabled by[ComplicationSlotsUserStyleSetting](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting).

use Watch Face Format instead

## Summary

|                                                                                                                               ### Nested types                                                                                                                               |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `interface `[ComplicationSlotsManager.TapCallback](https://developer.android.com/reference/kotlin/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/kotlin/androidx/wear/watchface/ComplicationSlotsManager#ComplicationSlotsManager(kotlin.collections.Collection,androidx.wear.watchface.style.CurrentUserStyleRepository))~~`(` ` complicationSlotCollection: `[Collection](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html)`<`[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)`>,` ` currentUserStyleRepository: `[CurrentUserStyleRepository](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/CurrentUserStyleRepository) `)` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead. |

|                                                   ### Public functions                                                    |
|---------------------------------------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                             | `@`[UiThread](https://developer.android.com/reference/kotlin/androidx/annotation/UiThread) ~~[addTapListener](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#addTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))~~`(tapCallback: `[ComplicationSlotsManager.TapCallback](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager.TapCallback)`)` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead.                                           |
| `open operator `[Boolean](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-boolean/index.html)                       | ~~[equals](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#equals(kotlin.Any))~~`(other: `[Any](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-any/index.html)`?)` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead.                                                                                                                                                                                                                                                                                     |
| `operator `[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)`?` | ~~[get](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#get(kotlin.Int))~~`(id: `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead.                                                                                                                                                                                                                                                                                               |
| [ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)`?`            | ~~[getBackgroundComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#getBackgroundComplicationSlot())~~`()` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead.                                                                                                                                                                                                                                                                                                                                      |
| [ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)`?`            | ~~[getComplicationSlotAt](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#getComplicationSlotAt(kotlin.Int,kotlin.Int))~~`(x: @`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, y: @`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`)` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
| `open `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)                                        | ~~[hashCode](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#hashCode())~~`()` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead.                                                                                                                                                                                                                                                                                                                                                                                |
| [Unit](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-unit/index.html)                                             | `@`[UiThread](https://developer.android.com/reference/kotlin/androidx/annotation/UiThread) ~~[removeTapListener](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#removeTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))~~`(tapCallback: `[ComplicationSlotsManager.TapCallback](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager.TapCallback)`)` **This function is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead.                                     |

|                                                                                                                                  ### Public properties                                                                                                                                  |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [Map](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, `[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)`>` | [complicationSlots](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#complicationSlots()) **This property is deprecated.**AndroidX watchface libraries are deprecated, use Watch Face Format instead.                         |
| [Map](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-map/index.html)`<`[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html)`, `[TapEvent](https://developer.android.com/reference/kotlin/androidx/wear/watchface/TapEvent)`>`                 | [lastComplicationTapDownEvents](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#lastComplicationTapDownEvents()) **This property 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)  

```
[ComplicationSlotsManager](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#ComplicationSlotsManager(kotlin.collections.Collection,androidx.wear.watchface.style.CurrentUserStyleRepository))(
    complicationSlotCollection: Collection<ComplicationSlot>,
    currentUserStyleRepository: CurrentUserStyleRepository
)
```
| **This function is deprecated.**   
AndroidX watchface libraries are deprecated, use Watch Face Format instead. For more info see: https://developer.android.com/training/wearables/wff  

|                                                                                                                      Parameters                                                                                                                      |
|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| `complicationSlotCollection: `[Collection](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin.collections/-collection/index.html)`<`[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)`>` | The[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)s associated with the watch face, may be empty.                                                                                                                                                                                         |
| `currentUserStyleRepository: `[CurrentUserStyleRepository](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/CurrentUserStyleRepository)                                                                                  | The[CurrentUserStyleRepository](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/CurrentUserStyleRepository)used to listen for[ComplicationSlotsUserStyleSetting](https://developer.android.com/reference/kotlin/androidx/wear/watchface/style/UserStyleSetting.ComplicationSlotsUserStyleSetting)changes and apply them. |

## Public functions

### 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
fun [addTapListener](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#addTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))(tapCallback: ComplicationSlotsManager.TapCallback): Unit
```
| **This function 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[TapCallback](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager.TapCallback)which is called whenever the user interacts with a complication slot.  

### equals

```
open operator fun [equals](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#equals(kotlin.Any))(other: Any?): Boolean
```
| **This function 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)  

```
operator fun [get](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#get(kotlin.Int))(id: Int): ComplicationSlot?
```
| **This function 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[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)corresponding to[id](https://developer.android.com/reference/kotlin/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)  

```
fun [getBackgroundComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#getBackgroundComplicationSlot())(): ComplicationSlot?
```
| **This function 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[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)if there is one or`null`otherwise.  

|                                                    Returns                                                     |
|----------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------|
| [ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)`?` | The background[ComplicationSlot](https://developer.android.com/reference/kotlin/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)  

```
fun [getComplicationSlotAt](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#getComplicationSlotAt(kotlin.Int,kotlin.Int))(x: @Px Int, y: @Px Int): ComplicationSlot?
```
| **This function 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                                                                            |
|-----------------------------------------------------------------------------------------------------------------------------------------------------------------|-----------------------------------------------------|
| `x: @`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The x coordinate of the point to perform a hit test |
| `y: @`[Px](https://developer.android.com/reference/kotlin/androidx/annotation/Px)` `[Int](https://kotlinlang.org/api/core/kotlin-stdlib/kotlin/-int/index.html) | The y coordinate of the point to perform a hit test |

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

### hashCode

```
open fun [hashCode](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#hashCode())(): Int
```
| **This function 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
fun [removeTapListener](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#removeTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback))(tapCallback: ComplicationSlotsManager.TapCallback): Unit
```
| **This function 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[TapCallback](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager.TapCallback)previously added by[addTapListener](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlotsManager#addTapListener(androidx.wear.watchface.ComplicationSlotsManager.TapCallback)).  

## Public properties

### complicationSlots

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)  

```
val complicationSlots: Map<Int, ComplicationSlot>
```
| **This property 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.  

### lastComplicationTapDownEvents

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)  

```
val lastComplicationTapDownEvents: Map<Int, TapEvent>
```
| **This property 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[ComplicationSlot](https://developer.android.com/reference/kotlin/androidx/wear/watchface/ComplicationSlot)id to the latest[TapType.DOWN](https://developer.android.com/reference/kotlin/androidx/wear/watchface/TapEvent)that the ComplicationSlot received, if any.