ComplicationSlot

public final class ComplicationSlot


Represents the slot an individual complication on the screen may go in. The number of ComplicationSlots is fixed (see ComplicationSlotsManager) but ComplicationSlots can be enabled or disabled via UserStyleSetting.ComplicationSlotsUserStyleSetting.

Summary

Nested types

ComplicationSlot.Builder

Builder for constructing ComplicationSlots.

ComplicationSlot.Companion

Public fields

final int

This is used to determine the order in which accessibility labels for the watch face are read to the user.

final int

The ComplicationSlotBoundsType of the complication slot.

final @NonNull CanvasComplicationFactory

The CanvasComplicationFactory used to generate a CanvasComplication for rendering the complication.

final @NonNull StateFlow<@NonNull ComplicationData>

The androidx.wear.watchface.complications.data.ComplicationData associated with the ComplicationSlot.

final @NonNull ComplicationSlotBounds

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

final @NonNull Bundle

Extras to be merged into the Intent sent when invoking the complication data source chooser activity.

final @NonNull DefaultComplicationDataSourcePolicy

The DefaultComplicationDataSourcePolicy which defines the default complicationSlots providers selected when the user hasn't yet made a choice.

final @NonNull ComplicationType

The default ComplicationType to use alongside defaultDataSourcePolicy.

final boolean

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

final boolean

Whether or not the complication data source is fixed (i.e.

final int

The Watch Face's ID for the complication slot.

final boolean

At creation a complication slot is either enabled or disabled.

final @NonNull CanvasComplication

The CanvasComplication used to render the complication.

final @NonNull List<@NonNull ComplicationType>

The types of complicationSlots the complication supports.

final @NonNull ComplicationTapFilter

The ComplicationTapFilter used to determine whether or not a tap hit the complication slot.

Public methods

final @NonNull Rect

Computes the bounds of the complication by converting the unitSquareBounds of the current complication type to pixels based on the screen's dimensions.

final boolean

Whether or not the complication should be considered active and should be rendered at the specified time.

final @UiThread void
render(
    @NonNull Canvas canvas,
    @NonNull ZonedDateTime zonedDateTime,
    @NonNull RenderParameters renderParameters
)

Watch faces should use this method to render a complication.

final @UiThread void
renderHighlightLayer(
    @NonNull Canvas canvas,
    @NonNull ZonedDateTime zonedDateTime,
    @NonNull RenderParameters renderParameters
)

Watch faces should use this method to render non-fixed complicationSlots for any highlight layer pass.

Public fields

accessibilityTraversalIndex

@NonNull
public final int accessibilityTraversalIndex

This is used to determine the order in which accessibility labels for the watch face are read to the user. Accessibility labels are automatically generated for the time and complicationSlots. See also Renderer.additionalContentDescriptionLabels.

boundsType

@NonNull
public final int boundsType

The ComplicationSlotBoundsType of the complication slot.

canvasComplicationFactory

@NonNull
public final @NonNull CanvasComplicationFactory canvasComplicationFactory

The CanvasComplicationFactory used to generate a CanvasComplication for rendering the complication. The factory allows us to decouple ComplicationSlot from potentially expensive as