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

Builder

class Builder
kotlin.Any
   ↳ androidx.wear.watchface.Complication.Builder

Builder for constructing Complications. Note before Builder.build the complication's bounds & type must be specified by calling one of: Builder.setUnitSquareBounds or Builder.setAsBackgroundComplication.

Summary

Public constructors
<init>(id: Int, renderer: CanvasComplication, supportedTypes: List<ComplicationType>, defaultProviderPolicy: DefaultComplicationProviderPolicy)

Builder for constructing Complications.

Public methods
Complication

Constructs the Complication.

Complication.Builder

Marks the complication as having type ComplicationBoundsType.BACKGROUND and sets the fractional bounds to cover the entire screen.

Complication.Builder

Sets the default complication provider data type.

Complication.Builder
setUnitSquareBounds(unitSquareBounds: RectF)

Sets the fractional bounds for the complication and marks it as having type ComplicationBoundsType.ROUND_RECT.

Public constructors

<init>

Builder(
    id: Int,
    renderer: CanvasComplication,
    supportedTypes: List<ComplicationType>,
    defaultProviderPolicy: DefaultComplicationProviderPolicy)

Builder for constructing Complications. Note before Builder.build the complication's bounds &amp; type must be specified by calling one of: Builder.setUnitSquareBounds or Builder.setAsBackgroundComplication.

Public methods

build

fun build(): Complication

Constructs the Complication. Note we require the complication's bounds &amp; type to have been be specified by calling one of: Builder.setUnitSquareBounds or Builder.setAsBackgroundComplication.

setAsBackgroundComplication

fun setAsBackgroundComplication(): Complication.Builder

Marks the complication as having type ComplicationBoundsType.BACKGROUND and sets the fractional bounds to cover the entire screen. A background complication is for watch faces that wish to have a full screen user selectable backdrop. This sort of complication isn't clickable and at most one may be present in the list of complications.

setDefaultProviderType

fun setDefaultProviderType(defaultProviderType: ComplicationType): Complication.Builder

Sets the default complication provider data type.

setUnitSquareBounds

fun setUnitSquareBounds(unitSquareBounds: RectF): Complication.Builder

Sets the fractional bounds for the complication and marks it as having type ComplicationBoundsType.ROUND_RECT. The bounds are clamped to the unit square 0..1, and subsequently converted to screen space coordinates. NB 0 and 1 are included in the unit square.