Google se compromete a impulsar la igualdad racial para las comunidades afrodescendientes. Obtén información al respecto.

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

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
ComplicationBounds

The complication's ComplicationBounds which are converted to pixels during rendering.

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.

CanvasComplication

The CanvasComplication used to render the complication.

List<ComplicationType>

The types of complications the complication supports.

Public methods

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

Properties

complicationBounds

var complicationBounds: ComplicationBounds

The complication's ComplicationBounds which are converted to pixels during rendering.

Note it's not allowed to change the bounds of a background complication because they are assumed to always cover the entire screen.

complicationData

val complicationData: ObservableWatchData<ComplicationData>

The androidx.wear.complications.data.ComplicationData associated with the Complication.

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. Must be non-empty.

Companion functions

createBackgroundComplicationBuilder

@JvmStatic fun createBackgroundComplicationBuilder(
    id: Int,
    renderer: CanvasComplication,
    supportedTypes: List<ComplicationType>,
    defaultProviderPolicy: DefaultComplicationProviderPolicy
): Complication.Builder

Constructs a Builder for a complication with bound type ComplicationBoundsType.BACKGROUND whose bounds 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.

createRoundRectComplicationBuilder

@JvmStatic fun createRoundRectComplicationBuilder(
    id: Int,
    renderer: CanvasComplication,
    supportedTypes: List<ComplicationType>,
    defaultProviderPolicy: DefaultComplicationProviderPolicy,
    complicationBounds: ComplicationBounds
): Complication.Builder

Constructs a Builder for a complication with bounds type ComplicationBoundsType.ROUND_RECT. This is the most common type of complication. These can be single tapped by the user to either trigger the associated intent or double tapped to open the provider selector.