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

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

Public constructors

ComplicationSlotsManager(
    @NonNull Collection<@NonNull ComplicationSlot> complicationSlotCollection,
    @NonNull CurrentUserStyleRepository currentUserStyleRepository
)

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

Public methods

final void

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

boolean
equals(Object other)

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

final ComplicationSlot
get(int id)

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
getComplicationSlotAt(@Px int x, @Px int y)

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

This method 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
public ComplicationSlotsManager(
    @NonNull Collection<@NonNull ComplicationSlot> complicationSlotCollection,
    @NonNull CurrentUserStyleRepository currentUserStyleRepository
)
Parameters
@NonNull Collection<@NonNull ComplicationSlot> complicationSlotCollection

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

@NonNull CurrentUserStyleRepository currentUserStyleRepository

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

Public methods

addTapListener

Added in 1.0.0
Deprecated in 1.3.0-alpha06
@UiThread
public final void addTapListener(
    @NonNull ComplicationSlotsManager.TapCallback tapCallback
)

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

equals

public boolean equals(Object other)

get

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final ComplicationSlot get(int id)

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

getBackgroundComplicationSlot

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final ComplicationSlot getBackgroundComplicationSlot()

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
public 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. 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 ComplicationSlot at coordinates x, y or {@code null} if there isn't one

getComplicationSlots

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull Map<@NonNull Integer, @NonNull ComplicationSlotgetComplicationSlots()

A map of complication IDs to complicationSlots.

getLastComplicationTapDownEvents

Added in 1.0.0
Deprecated in 1.3.0-alpha06
public final @NonNull Map<@NonNull Integer, @NonNull TapEventgetLastComplicationTapDownEvents()

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

hashCode

public int hashCode()

removeTapListener

Added in 1.0.0
Deprecated in 1.3.0-alpha06
@UiThread
public final void removeTapListener(
    @NonNull ComplicationSlotsManager.TapCallback tapCallback
)

Removes a TapCallback previously added by addTapListener.