Google is committed to advancing racial equity for Black communities. See how.

ComplicationsManager

class ComplicationsManager
kotlin.Any
   ↳ androidx.wear.watchface.ComplicationsManager

The Complications associated with the WatchFace. Dynamic creation of complications isn't supported, however complications can be enabled and disabled, perhaps as part of a user style see androidx.wear.watchface.style.UserStyleSetting.

Summary

Nested classes
abstract

Public constructors
<init>(complicationCollection: Collection<Complication>, userStyleRepository: UserStyleRepository)

The Complications associated with the WatchFace.

Public methods
Unit

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

Unit

Brings attention to the complication by briefly highlighting it to provide visual feedback when the user has tapped on it.

operator Complication?
get(id: Int)

Returns the Complication corresponding to id or null.

Complication?

Returns the background complication if there is one or {@code null} otherwise.

Complication?

Returns the id of the complication at coordinates x, y or {@code null} if there isn't one.

Unit

Removes a TapListener previously added by addTapListener.

Properties
Map<Int, Complication>

Public constructors

<init>

ComplicationsManager(
    complicationCollection: Collection<Complication>,
    userStyleRepository: UserStyleRepository)

The Complications associated with the WatchFace. Dynamic creation of complications isn't supported, however complications can be enabled and disabled, perhaps as part of a user style see androidx.wear.watchface.style.UserStyleSetting.

Public methods

addTapListener

@UiThread fun addTapListener(tapListener: ComplicationsManager.TapListener): Unit

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

bringAttentionToComplication

@UiThread fun bringAttentionToComplication(complicationId: Int): Unit

Brings attention to the complication by briefly highlighting it to provide visual feedback when the user has tapped on it.

Parameters
complicationId: Int The watch face's ID of the complication to briefly highlight

get

operator fun get(id: Int): Complication?

Returns the Complication corresponding to id or null.

getBackgroundComplication

fun getBackgroundComplication(): Complication?

Returns the background complication if there is one or {@code null} otherwise.

Return
The background complication if there is one or {@code null} otherwise

getComplicationAt

fun getComplicationAt(
    x: Int,
    y: Int
): Complication?

Returns the id of the complication at coordinates x, y or {@code null} if there isn't one.

Parameters
x: Int The x coordinate of the point to perform a hit test
y: Int The y coordinate of the point to perform a hit test
Return
The complication at coordinates x, y or {@code null} if there isn't one

removeTapListener

@UiThread fun removeTapListener(tapListener: ComplicationsManager.TapListener): Unit

Removes a TapListener previously added by addTapListener.

Properties

complications

val complications: Map<Int, Complication>