ComplicationSlotsManager


class ComplicationSlotsManager


The ComplicationSlots associated with the WatchFace. Dynamic creation of ComplicationSlots isn't supported, however complicationSlots can be enabled and disabled by ComplicationSlotsUserStyleSetting.

use Watch Face Format instead

Summary

Nested types

This interface is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public constructors

ComplicationSlotsManager(
    complicationSlotCollection: Collection<ComplicationSlot>,
    currentUserStyleRepository: CurrentUserStyleRepository
)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public functions

Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

open operator Boolean
equals(other: Any?)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

operator ComplicationSlot?
get(id: Int)

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

ComplicationSlot?

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

ComplicationSlot?

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

open Int

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Unit

This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public properties

Map<IntComplicationSlot>

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Map<IntTapEvent>

This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead.

Public constructors

ComplicationSlotsManager

Added in 1.0.0
Deprecated in 1.3.0-alpha06
ComplicationSlotsManager(
    complicationSlotCollection: Collection<ComplicationSlot>,
    currentUserStyleRepository: CurrentUserStyleRepository
)
Parameters
complicationSlotCollection: Collection<ComplicationSlot>

The ComplicationSlots associated with the watch face, may be empty.

currentUserStyleRepository: CurrentUserStyleRepository

The CurrentUserStyleRepository used to listen for ComplicationSlotsUserStyleSetting changes and apply them.

Public functions

addTapListener

Added in 1.0.0
Deprecated in 1.3.0-alpha06
@UiThread
fun addTapListener(tapCallback: ComplicationSlotsManager.TapCallback): Unit

Adds a TapCallback which is called whenever the user interacts with a complication slot.

equals

open operator fun equals(other: Any?): Boolean

get

Added in 1.0.0
Deprecated in 1.3.0-alpha06
operator fun get(id: Int): ComplicationSlot?

Returns the ComplicationSlot corresponding to id, if there is one, or null.

getBackgroundComplicationSlot

Added in 1.0.0
Deprecated in 1.3.0-alpha06
fun getBackgroundComplicationSlot(): ComplicationSlot?

Returns the background ComplicationSlot if there is one or null otherwise.

Returns
ComplicationSlot?

The background ComplicationSlot if there is one or null otherwise

getComplicationSlotAt

Added in 1.0.0
Deprecated in 1.3.0-alpha06
fun getComplicationSlotAt(x: @Px Int, y: @Px Int): ComplicationSlot?

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 Int

The x coordinate of the point to perform a hit test

y: @Px Int

The y coordinate of the point to perform a hit test

Returns
ComplicationSlot?

The ComplicationSlot at coordinates x, y or {@code null} if there isn't one

hashCode

open fun hashCode(): Int

removeTapListener

Added in 1.0.0
Deprecated in 1.3.0-alpha06
@UiThread
fun removeTapListener(tapCallback: ComplicationSlotsManager.TapCallback): Unit

Removes a TapCallback previously added by addTapListener.

Public properties

complicationSlots

Added in 1.0.0
Deprecated in 1.3.0-alpha06
val complicationSlotsMap<IntComplicationSlot>

A map of complication IDs to complicationSlots.

lastComplicationTapDownEvents

Added in 1.0.0
Deprecated in 1.3.0-alpha06
val lastComplicationTapDownEventsMap<IntTapEvent>

Map of ComplicationSlot id to the latest TapType.DOWN that the ComplicationSlot received, if any.