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 by ComplicationsUserStyleSetting.
Summary
Nested classes | |
---|---|
abstract |
Interface used to report user taps on the complication. |
Public constructors | |
---|---|
<init>(complicationCollection: Collection<Complication>, userStyleRepository: UserStyleRepository) The Complications associated with the WatchFace. |
Public methods | |
---|---|
Unit |
addTapListener(tapCallback: ComplicationsManager.TapCallback) Adds a TapCallback which is called whenever the user interacts with a complication. |
Unit |
bringAttentionToComplication(complicationId: Int) Brings attention to the complication by briefly highlighting it to provide visual feedback when the user has tapped on it. |
operator Complication? |
Returns the Complication corresponding to id, if there is one, or |
Complication? |
Returns the background complication if there is one or |
Complication? |
getComplicationAt(x: Int, y: Int) Returns the id of the complication at coordinates x, y or |
Unit |
removeTapListener(tapCallback: ComplicationsManager.TapCallback) Removes a TapCallback previously added by addTapListener. |
Properties | |
---|---|
Map<Int, Complication> |
A map of complication IDs to complications. |
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 by ComplicationsUserStyleSetting.
Public methods
addTapListener
@UiThread fun addTapListener(tapCallback: ComplicationsManager.TapCallback): Unit
Adds a TapCallback 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, if there is one, or null
.
getBackgroundComplication
fun getBackgroundComplication(): Complication?
Returns the background complication if there is one or null
otherwise.
Return | |
---|---|
The background complication if there is one or | null otherwise |
getComplicationAt
fun getComplicationAt(
x: Int,
y: Int
): Complication?
Returns the id of the complication at coordinates x, y or 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(tapCallback: ComplicationsManager.TapCallback): Unit
Removes a TapCallback previously added by addTapListener.