ComplicationSlot.Companion

object ComplicationSlot.Companion


Summary

Public methods

final @NonNull ComplicationSlot.Builder
createBackgroundComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy
)

Constructs a Builder for a complication with bound type ComplicationSlotBoundsType.BACKGROUND whose bounds cover the entire screen.

final @NonNull ComplicationSlot.Builder
createEdgeComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy,
    ComplicationSlotBounds bounds,
    ComplicationTapFilter complicationTapFilter
)

Constructs a Builder for a complication with bounds type ComplicationSlotBoundsType.EDGE.

final @ComplicationExperimental @NonNull ComplicationSlot.Builder
createEdgeComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy,
    ComplicationSlotBounds bounds,
    BoundingArc boundingArc,
    ComplicationTapFilter complicationTapFilter
)

Constructs a Builder for a complication with bounds type ComplicationSlotBoundsType.EDGE, whose contents are contained within boundingArc.

final @NonNull ComplicationSlot.Builder
createRoundRectComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy,
    ComplicationSlotBounds bounds
)

Constructs a Builder for a complication with bounds type ComplicationSlotBoundsType.ROUND_RECT.

Public methods

createBackgroundComplicationSlotBuilder

public final @NonNull ComplicationSlot.Builder createBackgroundComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy
)

Constructs a Builder for a complication with bound type ComplicationSlotBoundsType.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 complicationSlots.

Parameters
int id

The watch face's ID for this complication. Can be any integer but should be unique within the watch face.

CanvasComplicationFactory canvasComplicationFactory

The CanvasComplicationFactory to supply the CanvasComplication to use for rendering. Note renderers should not be shared between complicationSlots.

List<ComplicationType> supportedTypes

The types of complication supported by this ComplicationSlot. Used during complication, this list should be non-empty.

DefaultComplicationDataSourcePolicy defaultDataSourcePolicy

The DefaultComplicationDataSourcePolicy used to select the initial complication data source when the watch is first installed.

createEdgeComplicationSlotBuilder

public final @NonNull ComplicationSlot.Builder createEdgeComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy,
    ComplicationSlotBounds bounds,
    ComplicationTapFilter complicationTapFilter
)

Constructs a Builder for a complication with bounds type ComplicationSlotBoundsType.EDGE.

An edge complication is drawn around the border of the display and has custom hit test logic (see complicationTapFilter). When tapped the associated intent is dispatched. Edge complicationSlots should have a custom renderer with CanvasComplication.drawHighlight overridden.

Note hit detection in an editor for ComplicationSlots created with this method is not supported.

Parameters
int id

The watch face's ID for this complication. Can be any integer but should be unique within the watch face.

CanvasComplicationFactory canvasComplicationFactory

The CanvasComplicationFactory to supply the CanvasComplication to use for rendering. Note renderers should not be shared between complicationSlots.

List<ComplicationType> supportedTypes

The types of complication supported by this ComplicationSlot. Used during complication, this list should be non-empty.

DefaultComplicationDataSourcePolicy defaultDataSourcePolicy

The DefaultComplicationDataSourcePolicy used to select the initial complication data source when the watch is first installed.

ComplicationSlotBounds bounds

The complication's ComplicationSlotBounds. Its likely the bounding rect will be much larger than the complication and shouldn't directly be used for hit testing.

ComplicationTapFilter complicationTapFilter

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

createEdgeComplicationSlotBuilder

@ComplicationExperimental
public final @NonNull ComplicationSlot.Builder createEdgeComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy,
    ComplicationSlotBounds bounds,
    BoundingArc boundingArc,
    ComplicationTapFilter complicationTapFilter
)

Constructs a Builder for a complication with bounds type ComplicationSlotBoundsType.EDGE, whose contents are contained within boundingArc.

Parameters
int id

The watch face's ID for this complication. Can be any integer but should be unique within the watch face.

CanvasComplicationFactory canvasComplicationFactory

The CanvasComplicationFactory to supply the CanvasComplication to use for rendering. Note renderers should not be shared between complicationSlots.

List<ComplicationType> supportedTypes

The types of complication supported by this ComplicationSlot. Used during complication, this list should be non-empty.

DefaultComplicationDataSourcePolicy defaultDataSourcePolicy

The DefaultComplicationDataSourcePolicy used to select the initial complication data source when the watch is first installed.

ComplicationSlotBounds bounds

The complication's ComplicationSlotBounds. Its likely the bounding rect will be much larger than the complication and shouldn't directly be used for hit testing.

createRoundRectComplicationSlotBuilder

public final @NonNull ComplicationSlot.Builder createRoundRectComplicationSlotBuilder(
    int id,
    CanvasComplicationFactory canvasComplicationFactory,
    List<ComplicationType> supportedTypes,
    DefaultComplicationDataSourcePolicy defaultDataSourcePolicy,
    ComplicationSlotBounds bounds
)

Constructs a Builder for a complication with bounds type ComplicationSlotBoundsType.ROUND_RECT. This is the most common type of complication. These can be tapped by the user to trigger the associated intent.

Parameters
int id

The watch face's ID for this complication. Can be any integer but should be unique within the watch face.

CanvasComplicationFactory canvasComplicationFactory

The CanvasComplicationFactory to supply the CanvasComplication to use for rendering. Note renderers should not be shared between complicationSlots.

List<ComplicationType> supportedTypes

The types of complication supported by this ComplicationSlot. Used during complication, this list should be non-empty.

DefaultComplicationDataSourcePolicy defaultDataSourcePolicy

The DefaultComplicationDataSourcePolicy used to select the initial complication data source when the watch is first installed.

ComplicationSlotBounds bounds

The complication's ComplicationSlotBounds.