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

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 as needed.

Summary

Nested classes

Builder for constructing Complications.

Public methods
Unit

Requests redraw of the watch face.

Unit
render(canvas: Canvas, calendar: Calendar, renderParameters: RenderParameters)

Watch faces should use this method to render a complication.

Properties
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.

CanvasComplication

The CanvasComplication used to render the complication.

List<ComplicationType>

The types of complications the complication supports.

RectF

The screen space unit-square bounds of the complication.

Public methods

invalidate

fun invalidate(): Unit

Requests redraw of the watch face. Useful when initialization is asynchronous, e.g. when loading a Drawable.

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
canvas: Canvas The Canvas to render into
calendar: Calendar The current Calendar
renderParameters: RenderParameters The current RenderParameters

Properties

defaultProviderPolicy

var defaultProviderPolicy: DefaultComplicationProviderPolicy

The DefaultComplicationProviderPolicy which defines the default complications providers selected when the user hasn't yet made a choice. See also .defaultProviderType.

defaultProviderType

var defaultProviderType: ComplicationType

The default ComplicationData.ComplicationType to use alongside .defaultProviderPolicy.

enabled

var enabled: Boolean

Whether or not the complication should be drawn and accept taps.

renderer

var renderer: CanvasComplication

The CanvasComplication used to render the complication.

supportedTypes

var supportedTypes: List<ComplicationType>

The types of complications the complication supports.

unitSquareBounds

var unitSquareBounds: RectF

The screen space unit-square bounds of the complication. This is converted to pixels during rendering.