RangedValueComplicationData.Builder


class RangedValueComplicationData.Builder


Builder for RangedValueComplicationData.

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

Summary

Public constructors

@RequiresApi(value = 34)
Builder(
    dynamicValue: DynamicBuilders.DynamicFloat,
    min: Float,
    max: Float,
    contentDescription: ComplicationText
)

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

Builder(
    value: Float,
    min: Float,
    max: Float,
    contentDescription: ComplicationText
)

Creates a Builder for a RangedValueComplicationData with a Float value.

@RequiresApi(value = 33)
Builder(
    dynamicValue: DynamicBuilders.DynamicFloat,
    fallbackValue: Float,
    min: Float,
    max: Float,
    contentDescription: ComplicationText
)

Creates a Builder for a RangedValueComplicationData with a DynamicFloat value.

Public functions

open RangedValueComplicationData

Builds the RangedValueComplicationData.

RangedValueComplicationData.Builder
setColorRamp(colorRamp: ColorRamp?)

Sets an optional hint that the renderer should draw the progress bar using the ColorRamp.

RangedValueComplicationData.Builder

Sets optional icon associated with the complication data.

RangedValueComplicationData.Builder
setSmallImage(smallImage: SmallImage?)

Sets optional image associated with the complication data.

RangedValueComplicationData.Builder

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

RangedValueComplicationData.Builder

Sets optional text associated with the complication data.

RangedValueComplicationData.Builder

Sets optional title associated with the complication data.

RangedValueComplicationData.Builder
setValidTimeRange(validTimeRange: TimeRange?)

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

RangedValueComplicationData.Builder
setValueType(valueType: Int)

Sets the semantic meaning of value.

Public constructors

Builder

Added in 1.3.0-alpha04
@RequiresApi(value = 34)
Builder(
    dynamicValue: DynamicBuilders.DynamicFloat,
    min: Float,
    max: Float,
    contentDescription: ComplicationText
)

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

Parameters
dynamicValue: DynamicBuilders.DynamicFloat

The DynamicFloat of the ranged complication which will be evaluated into a value dynamically, and should be in the range [min] .. [max]. The semantic meaning of value can be specified via setValueType.

min: Float

The minimum value. For TYPE_PERCENTAGE this must be 0f.

max: Float

The maximum value. This must be less than Float.MAX_VALUE. For TYPE_PERCENTAGE this must be 0f.

contentDescription: ComplicationText

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.0.0
Builder(
    value: Float,
    min: Float,
    max: Float,
    contentDescription: ComplicationText
)

Creates a Builder for a RangedValueComplicationData with a Float value.

Parameters
value: Float

The value of the ranged complication which should be in the range [min] .. [max]. The semantic meaning of value can be specified via setValueType.

min: Float

The minimum value. For TYPE_PERCENTAGE this must be 0f.

max: Float

The maximum value. This must be less than Float.MAX_VALUE. For TYPE_PERCENTAGE this must be 0f.

contentDescription: ComplicationText

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)
Builder(
    dynamicValue: DynamicBuilders.DynamicFloat,
    fallbackValue: Float,
    min: Float,
    max: Float,
    contentDescription: ComplicationText
)

Creates a Builder for a RangedValueComplicationData with a DynamicFloat value.

Parameters
dynamicValue: DynamicBuilders.DynamicFloat

The DynamicFloat of the ranged complication which will be evaluated into a value dynamically, and should be in the range [min] .. [max]. The semantic meaning of value can be specified via setValueType.

fallbackValue: Float

The fallback value of the ranged complication used on systems that don't support dynamicValue, which should be in the range [min] .. [max]. The semantic meaning of value can be specified via setValueType.

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 dynamicValue cannot be evaluated, e.g. when a data source is not available.

min: Float

The minimum value. For TYPE_PERCENTAGE this must be 0f.

max: Float

The maximum value. This must be less than Float.MAX_VALUE. For TYPE_PERCENTAGE this must be 0f.

contentDescription: ComplicationText

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 functions

build

Added in 1.0.0
open fun build(): RangedValueComplicationData

Builds the RangedValueComplicationData.

setColorRamp

Added in 1.2.0
fun setColorRamp(colorRamp: ColorRamp?): RangedValueComplicationData.Builder

Sets an optional hint that the renderer should draw the progress bar using the ColorRamp.

setMonochromaticImage

Added in 1.0.0
fun setMonochromaticImage(monochromaticImage: MonochromaticImage?): RangedValueComplicationData.Builder

Sets optional icon associated with the complication data.

setSmallImage

Added in 1.2.0
fun setSmallImage(smallImage: SmallImage?): RangedValueComplicationData.Builder

Sets optional image associated with the complication data.

setTapAction

Added in 1.0.0
fun setTapAction(tapAction: PendingIntent?): RangedValueComplicationData.Builder

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

setText

Added in 1.0.0
fun setText(text: ComplicationText?): RangedValueComplicationData.Builder

Sets optional text associated with the complication data.

setTitle

Added in 1.0.0
fun setTitle(title: ComplicationText?): RangedValueComplicationData.Builder

Sets optional title associated with the complication data.

setValidTimeRange

Added in 1.0.0
fun setValidTimeRange(validTimeRange: TimeRange?): RangedValueComplicationData.Builder

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

setValueType

Added in 1.2.0
fun setValueType(valueType: Int): RangedValueComplicationData.Builder

Sets the semantic meaning of value. The complication renderer may choose to visually differentiate between the different types, for example rendering a dot on a line/arc to indicate the value for a TYPE_RATING. Defaults to TYPE_UNDEFINED if not set.