Complication
class Complication
kotlin.Any | |
↳ | androidx.wear.watchface.Complication |
Represents a individual complication on the screen. The number of complications is fixed (see ComplicationsManager) but complications can be enabled or disabled via UserStyleSetting.ComplicationsUserStyleSetting.
Summary
Nested classes | |
---|---|
Builder for constructing Complications. |
Public methods | |
---|---|
Rect |
computeBounds(screen: Rect) Computes the bounds of the complication by converting the unitSquareBounds to pixels. |
Unit |
Requests redraw of the watch face. |
Boolean |
isActiveAt(dateTimeMillis: Long) Whether or not the complication should be considered active and should be rendered at the specified time. |
Unit |
render(canvas: Canvas, calendar: Calendar, renderParameters: RenderParameters) Watch faces should use this method to render a complication. |
Companion functions | |
---|---|
Complication.Builder |
createBackgroundComplicationBuilder(id: Int, renderer: CanvasComplication, supportedTypes: List<ComplicationType>, defaultProviderPolicy: DefaultComplicationProviderPolicy) Constructs a Builder for a complication with bound type ComplicationBoundsType.BACKGROUND whose bounds cover the entire screen. |
Complication.Builder |
createRoundRectComplicationBuilder(id: Int, renderer: CanvasComplication, supportedTypes: List<ComplicationType>, defaultProviderPolicy: DefaultComplicationProviderPolicy, complicationBounds: ComplicationBounds) Constructs a Builder for a complication with bounds type ComplicationBoundsType.ROUND_RECT. |
Properties | |
---|---|
Int | |
ComplicationBounds |
The complication's ComplicationBounds which are converted to pixels during rendering. |
Bundle? |
Extras to be merged into the Intent sent when invoking the provider chooser activity. |
ObservableWatchData<ComplicationData> |
The androidx.wear.complications.data.ComplicationData associated with the Complication. |
DefaultComplicationProviderPolicy |
The DefaultComplicationProviderPolicy which defines the default complications providers selected when the user hasn't yet made a choice. |
ComplicationType |
The default ComplicationData.ComplicationType to use alongside defaultProviderPolicy. |
Boolean |
Whether or not the complication should be drawn and accept taps. |
Boolean |
Whether or not the complication provider is fixed. |
CanvasComplication |
The CanvasComplication used to render the complication. |
List<ComplicationType> |
The types of complications the complication supports. |
Public methods
computeBounds
fun computeBounds(screen: Rect): Rect
Computes the bounds of the complication by converting the unitSquareBounds to pixels.
invalidate
fun invalidate(): Unit
Requests redraw of the watch face. Useful when initialization is asynchronous, e.g. when loading a Drawable.
isActiveAt
fun isActiveAt(dateTimeMillis: Long): Boolean
Whether or not the complication should be considered active and should be rendered at the specified time.
render
@UiThread fun render(
canvas: Canvas,
calendar: Calendar,
renderParameters: RenderParameters
): Unit
Watch faces should use this method to render a complication. Note the system may call this.
Parameters | |
---|---|