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 |
|---|
interface ComplicationSlotsManager.TapCallbackThis interface is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors |
|---|
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public functions |
|
|---|---|
Unit |
@UiThreadThis function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
open operator Boolean |
This function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
operator 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. |
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 |
@UiThreadThis function is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public properties |
|
|---|---|
Map<Int, ComplicationSlot> |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Map<Int, TapEvent> |
This property is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors
ComplicationSlotsManager
ComplicationSlotsManager(
complicationSlotCollection: Collection<ComplicationSlot>,
currentUserStyleRepository: CurrentUserStyleRepository
)
| Parameters | |
|---|---|
complicationSlotCollection: Collection<ComplicationSlot> |
The |
currentUserStyleRepository: CurrentUserStyleRepository |
The |
Public functions
addTapListener
@UiThread
funaddTapListener(tapCallback: ComplicationSlotsManager.TapCallback): Unit
Adds a TapCallback which is called whenever the user interacts with a complication slot.
get
operator funget(id: Int): ComplicationSlot?
Returns the ComplicationSlot corresponding to id, if there is one, or null.
getBackgroundComplicationSlot
fungetBackgroundComplicationSlot(): ComplicationSlot?
Returns the background ComplicationSlot if there is one or null otherwise.
| Returns | |
|---|---|
ComplicationSlot? |
The background |
getComplicationSlotAt
fungetComplicationSlotAt(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 |
removeTapListener
@UiThread
funremoveTapListener(tapCallback: ComplicationSlotsManager.TapCallback): Unit
Removes a TapCallback previously added by addTapListener.
Public properties
complicationSlots
val complicationSlots: Map<Int, ComplicationSlot>
A map of complication IDs to complicationSlots.
lastComplicationTapDownEvents
val lastComplicationTapDownEvents: Map<Int, TapEvent>
Map of ComplicationSlot id to the latest TapType.DOWN that the ComplicationSlot received, if any.