ComplicationSlotsManager

public final class ComplicationSlotsManager


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

Summary

Nested types

ComplicationSlotsManager.TapCallback

Interface used to report user taps on the ComplicationSlot.

Public fields

final @NonNull Map<@NonNull Integer, @NonNull ComplicationSlot>

A map of complication IDs to complicationSlots.

final @NonNull Map<@NonNull Integer, @NonNull TapEvent>

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

Public constructors

ComplicationSlotsManager(
    Collection<ComplicationSlot> complicationSlotCollection,
    CurrentUserStyleRepository currentUserStyleRepository
)

Public methods

final @UiThread void

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

final ComplicationSlot
get(int id)

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

final ComplicationSlot

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

final ComplicationSlot
getComplicationSlotAt(@Px int x, @Px int y)

Returns the id of the complication slot at coordinates x, y or null if there isn't one.

final @UiThread void

Removes a TapCallback previously added by addTapListener.

Public fields

complicationSlots

public final @NonNull Map<@NonNull Integer, @NonNull ComplicationSlot