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.
use Watch Face Format instead
Summary
Nested types |
|---|
public interface ComplicationSlotsManager.TapCallbackThis interface is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors |
|---|
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public methods |
|
|---|---|
final void |
@UiThreadThis method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
boolean |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final ComplicationSlot |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final ComplicationSlot |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final ComplicationSlot |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull Map<@NonNull Integer, @NonNull ComplicationSlot> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final @NonNull Map<@NonNull Integer, @NonNull TapEvent> |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
int |
This method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
final void |
@UiThreadThis method is deprecated. AndroidX watchface libraries are deprecated, use Watch Face Format instead. |
Public constructors
ComplicationSlotsManager
publicComplicationSlotsManager(
@NonNull Collection<@NonNull ComplicationSlot> complicationSlotCollection,
@NonNull CurrentUserStyleRepository currentUserStyleRepository
)
| Parameters | |
|---|---|
@NonNull Collection<@NonNull ComplicationSlot> complicationSlotCollection |
The |
@NonNull CurrentUserStyleRepository currentUserStyleRepository |
The |
Public methods
addTapListener
@UiThread
public final voidaddTapListener(
@NonNull ComplicationSlotsManager.TapCallback tapCallback
)
Adds a TapCallback which is called whenever the user interacts with a complication slot.
get
public final ComplicationSlotget(int id)
Returns the ComplicationSlot corresponding to id, if there is one, or null.
getBackgroundComplicationSlot
public final ComplicationSlotgetBackgroundComplicationSlot()
Returns the background ComplicationSlot if there is one or null otherwise.
| Returns | |
|---|---|
ComplicationSlot |
The background |
getComplicationSlotAt
public final ComplicationSlotgetComplicationSlotAt(@Px int x, @Px int y)
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 | |
|---|---|
@Px int x |
The x coordinate of the point to perform a hit test |
@Px int y |
The y coordinate of the point to perform a hit test |
| Returns | |
|---|---|
ComplicationSlot |
The |
getComplicationSlots
public final @NonNull Map<@NonNull Integer, @NonNull ComplicationSlot>getComplicationSlots()
A map of complication IDs to complicationSlots.
getLastComplicationTapDownEvents
public final @NonNull Map<@NonNull Integer, @NonNull TapEvent>getLastComplicationTapDownEvents()
Map of ComplicationSlot id to the latest TapType.DOWN that the ComplicationSlot received, if any.
removeTapListener
@UiThread
public final voidremoveTapListener(
@NonNull ComplicationSlotsManager.TapCallback tapCallback
)
Removes a TapCallback previously added by addTapListener.