SmallImageComplicationData.Builder

public final class SmallImageComplicationData.Builder


Builder for SmallImageComplicationData.

You must at a minimum set the smallImage and contentDescription fields.

Summary

Public constructors

Builder(
    @NonNull SmallImage smallImage,
    @NonNull ComplicationText contentDescription
)

Public methods

@NonNull SmallImageComplicationData

Builds the MonochromaticImageComplicationData.

final @NonNull SmallImageComplicationData.Builder

Sets the ComponentName of the ComplicationDataSourceService that provided this ComplicationData, if any.

final @NonNull SmallImageComplicationData.Builder
@RequiresApi(value = 33)
setDisplayPolicy(int displayPolicy)

Sets the complication's display policy.

final @NonNull SmallImageComplicationData.Builder

Sets the complication's fallback, used in case any dynamic value cannot be evaluated, e.g. when a data source is not available.

final @NonNull SmallImageComplicationData.Builder
@RequiresApi(value = 33)
setPersistencePolicy(int persistencePolicy)

Sets the complication's persistence policy.

final @NonNull SmallImageComplicationData.Builder

Sets optional pending intent to be invoked when the complication is tapped.

final @NonNull SmallImageComplicationData.Builder
setValidTimeRange(TimeRange validTimeRange)

Sets optional time range during which the complication has to be shown.

Public constructors

Builder

Added in 1.0.0
public Builder(
    @NonNull SmallImage smallImage,
    @NonNull ComplicationText contentDescription
)
Parameters
@NonNull SmallImage smallImage

The SmallImage to be displayed

@NonNull ComplicationText contentDescription

The content description field for accessibility and is used to describe what data the image represents. If the image is purely stylistic, and does not convey any information to the user, then provide an empty content description. If no content description is provided, a generic content description will be used instead. Please do not include the word 'complication' in the description.

Public methods

setDataSource

Added in 1.1.0
public final @NonNull SmallImageComplicationData.Builder setDataSource(ComponentName dataSource)

Sets the ComponentName of the ComplicationDataSourceService that provided this ComplicationData, if any.

Note a ComplicationDataSourceService does not need to call this because the system will set this value on its behalf.

setDisplayPolicy

Added in 1.2.0
@RequiresApi(value = 33)
public final @NonNull SmallImageComplicationData.Builder setDisplayPolicy(int displayPolicy)

Sets the complication's display policy.

setDynamicValueInvalidationFallback

Added in 1.3.0-alpha01
public final @NonNull SmallImageComplicationData.Builder setDynamicValueInvalidationFallback(
    SmallImageComplicationData fallback
)

Sets the complication's fallback, used in case any dynamic value cannot be evaluated, e.g. when a data source is not available.

IMPORTANT: This is only used when the system supports dynamic values. See each dynamic value field's fallback companion field for the situation where the system does not support dynamic values at all.

setPersistencePolicy

Added in 1.2.0
@RequiresApi(value = 33)
public final @NonNull SmallImageComplicationData.Builder setPersistencePolicy(int persistencePolicy)

Sets the complication's persistence policy.

setTapAction

Added in 1.0.0
public final @NonNull SmallImageComplicationData.Builder setTapAction(PendingIntent tapAction)

Sets optional pending intent to be invoked when the complication is tapped.

setValidTimeRange

Added in 1.0.0
public final @NonNull SmallImageComplicationData.Builder setValidTimeRange(TimeRange validTimeRange)

Sets optional time range during which the complication has to be shown.