WeightedElementsComplicationData.Builder


@RequiresApi(value = 33)
class WeightedElementsComplicationData.Builder


Builder for WeightedElementsComplicationData.

You must at a minimum set the elements field and at least one of monochromaticImage, smallImage, text or title.

Summary

Public constructors

Builder(
    elements: List<WeightedElementsComplicationData.Element>,
    contentDescription: ComplicationText
)

Public functions

open WeightedElementsComplicationData

Builds the GoalProgressComplicationData.

WeightedElementsComplicationData.Builder
setElementBackgroundColor(elementBackgroundColor: @ColorInt Int)

Sets the background color to use between the elements if they are drawn segmented.

WeightedElementsComplicationData.Builder

Sets optional icon associated with the complication data.

WeightedElementsComplicationData.Builder
setSmallImage(smallImage: SmallImage?)

Sets optional image associated with the complication data.

WeightedElementsComplicationData.Builder

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

WeightedElementsComplicationData.Builder

Sets optional text associated with the complication data.

WeightedElementsComplicationData.Builder

Sets optional title associated with the complication data.

WeightedElementsComplicationData.Builder
setValidTimeRange(validTimeRange: TimeRange?)

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

Public constructors

Builder

Added in 1.2.0
Builder(
    elements: List<WeightedElementsComplicationData.Element>,
    contentDescription: ComplicationText
)
Parameters
elements: List<WeightedElementsComplicationData.Element>

The breakdown of the subject into various Elements. E.g. the proportion of calories consumed which were carbohydrates, fats etc... The tapAction must take the user to an experience where the color key becomes obvious. The maximum valid size of this list is provided by getMaxElements.

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.2.0
open fun build(): WeightedElementsComplicationData

Builds the GoalProgressComplicationData.

setElementBackgroundColor

Added in 1.2.0
fun setElementBackgroundColor(elementBackgroundColor: @ColorInt Int): WeightedElementsComplicationData.Builder

Sets the background color to use between the elements if they are drawn segmented. Defaults to Color.TRANSPARENT if not set.

setMonochromaticImage

Added in 1.2.0
fun setMonochromaticImage(monochromaticImage: MonochromaticImage?): WeightedElementsComplicationData.Builder

Sets optional icon associated with the complication data.

setSmallImage

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

Sets optional image associated with the complication data.

setTapAction

Added in 1.2.0
fun setTapAction(tapAction: PendingIntent?): WeightedElementsComplicationData.Builder

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

setText

Added in 1.2.0
fun setText(text: ComplicationText?): WeightedElementsComplicationData.Builder

Sets optional text associated with the complication data.

setTitle

Added in 1.2.0
fun setTitle(title: ComplicationText?): WeightedElementsComplicationData.Builder

Sets optional title associated with the complication data.

setValidTimeRange

Added in 1.2.0
fun setValidTimeRange(validTimeRange: TimeRange?): WeightedElementsComplicationData.Builder

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