GoalProgressComplicationData.Builder


@RequiresApi(value = 33)
public final class GoalProgressComplicationData.Builder


Builder for GoalProgressComplicationData.

You must at a minimum set the targetValue and contentDescription fields, one of value or dynamicValue, and at least one of monochromaticImage, smallImage, text or title.

Summary

Public constructors

@RequiresApi(value = 34)
Builder(
    @NonNull DynamicBuilders.DynamicFloat dynamicValue,
    float targetValue,
    @NonNull ComplicationText contentDescription
)

Creates a Builder for a RangedValueComplicationData with a DynamicFloat value, and no fallbackValue for API levels known to support dynamic values.

Builder(
    float value,
    float targetValue,
    @NonNull ComplicationText contentDescription
)

Creates a Builder for a GoalProgressComplicationData with a Float value.

@RequiresApi(value = 33)
Builder(
    @NonNull DynamicBuilders.DynamicFloat dynamicValue,
    float fallbackValue,
    float targetValue,
    @NonNull ComplicationText contentDescription
)

Creates a Builder for a GoalProgressComplicationData with a DynamicFloat value.

Public methods

@NonNull GoalProgressComplicationData

Builds the GoalProgressComplicationData.

final @NonNull GoalProgressComplicationData.Builder

Sets an optional hint which suggests the renderer draws the complication using a ColorRamp.

final @NonNull GoalProgressComplicationData.Builder

Sets optional icon associated with the complication data.

final @NonNull GoalProgressComplicationData.Builder

Sets optional image associated with the complication data.

final @NonNull GoalProgressComplicationData.Builder

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

final @NonNull GoalProgressComplicationData.Builder

Sets optional text associated with the complication data.

final @NonNull GoalProgressComplicationData.Builder

Sets optional title associated with the complication data.

final @NonNull GoalProgressComplicationData.Builder
setValidTimeRange(TimeRange validTimeRange)

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

Public constructors

Builder

Added in 1.3.0-alpha04
@RequiresApi(value = 34)
public Builder(
    @NonNull DynamicBuilders.DynamicFloat dynamicValue,
    float targetValue,
    @NonNull ComplicationText contentDescription
)

Creates a Builder for a RangedValueComplicationData with a DynamicFloat value, and no fallbackValue for API levels known to support dynamic values.

Parameters
@NonNull DynamicBuilders.DynamicFloat dynamicValue

The DynamicFloat of the goal complication which will be evaluated into a value dynamically, and should be >= 0.

float targetValue

The target value. This must be less than Float.MAX_VALUE.

@NonNull ComplicationText contentDescription

Defines localized text that briefly describes content of the complication. This property is used primarily for accessibility. Since some complications do not have textual representation this attribute can be used for providing such. Please do not include the word 'complication' in the description.

Builder

Added in 1.2.0
public Builder(
    float value,
    float targetValue,
    @NonNull ComplicationText contentDescription
)

Creates a Builder for a GoalProgressComplicationData with a Float value.

Parameters
float value

The value of the goal complication which should be >= 0.

float targetValue

The target value. This must be less than Float.MAX_VALUE.

@NonNull ComplicationText contentDescription

Defines localized text that briefly describes content of the complication. This property is used primarily for accessibility. Since some complications do not have textual representation this attribute can be used for providing such. Please do not include the word 'complication' in the description.

Builder

Added in 1.2.0
@RequiresApi(value = 33)
public Builder(
    @NonNull DynamicBuilders.DynamicFloat dynamicValue,
    float fallbackValue,
    float targetValue,
    @NonNull ComplicationText contentDescription
)

Creates a Builder for a GoalProgressComplicationData with a DynamicFloat value.

Parameters
@NonNull DynamicBuilders.DynamicFloat dynamicValue

The DynamicFloat of the goal complication which will be evaluated into a value dynamically, and should be >= 0.

float fallbackValue

The fallback value of the goal complication which will be used on systems that don't support dynamicValue, and should be >= 0.

This is only relevant before Build.VERSION_CODES.UPSIDE_DOWN_CAKE, use the no-fallback constructor if you target an equal or higher API level.

IMPORTANT: This is only used when the system does not support dynamicValue at all. See setDynamicValueInvalidationFallback for the situation where the dynamicValue cannot be evaluated, e.g. when a data source is not available.

float targetValue

The target value. This must be less than Float.MAX_VALUE.

@NonNull ComplicationText contentDescription

Defines localized text that briefly describes content of the complication. This property is used primarily for accessibility. Since some complications do not have textual representation this attribute can be used for providing such. Please do not include the word 'complication' in the description.

Public methods

setColorRamp

Added in 1.2.0
public final @NonNull GoalProgressComplicationData.Builder setColorRamp(ColorRamp colorRamp)

Sets an optional hint which suggests the renderer draws the complication using a ColorRamp.

setMonochromaticImage

Added in 1.2.0
public final @NonNull GoalProgressComplicationData.Builder setMonochromaticImage(MonochromaticImage monochromaticImage)

Sets optional icon associated with the complication data.

setSmallImage

Added in 1.2.0
public final @NonNull GoalProgressComplicationData.Builder setSmallImage(SmallImage smallImage)

Sets optional image associated with the complication data.

setTapAction

Added in 1.2.0
public final @NonNull GoalProgressComplicationData.Builder setTapAction(PendingIntent tapAction)

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

setText

Added in 1.2.0
public final @NonNull GoalProgressComplicationData.Builder setText(ComplicationText text)

Sets optional text associated with the complication data.

setTitle

Added in 1.2.0
public final @NonNull GoalProgressComplicationData.Builder setTitle(ComplicationText title)

Sets optional title associated with the complication data.

setValidTimeRange

Added in 1.2.0
public final @NonNull GoalProgressComplicationData.Builder setValidTimeRange(TimeRange validTimeRange)

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