WeightedElementsComplicationData.Builder


@RequiresApi(value = 33)
public final 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

Public methods

@NonNull WeightedElementsComplicationData

Builds the GoalProgressComplicationData.

final @NonNull WeightedElementsComplicationData.Builder
setElementBackgroundColor(@ColorInt int elementBackgroundColor)

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

final @NonNull WeightedElementsComplicationData.Builder

Sets optional icon associated with the complication data.

final @NonNull WeightedElementsComplicationData.Builder

Sets optional image associated with the complication data.

final @NonNull WeightedElementsComplicationData.Builder

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

final @NonNull WeightedElementsComplicationData.Builder

Sets optional text associated with the complication data.

final @NonNull WeightedElementsComplicationData.Builder

Sets optional title associated with the complication data.

final @NonNull WeightedElementsComplicationData.Builder
setValidTimeRange(TimeRange validTimeRange)

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

Public constructors

Builder

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

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.

@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

setElementBackgroundColor

Added in 1.2.0
public final @NonNull WeightedElementsComplicationData.Builder setElementBackgroundColor(@ColorInt int elementBackgroundColor)

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
public final @NonNull WeightedElementsComplicationData.Builder setMonochromaticImage(MonochromaticImage monochromaticImage)

Sets optional icon associated with the complication data.

setSmallImage

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

Sets optional image associated with the complication data.

setTapAction

Added in 1.2.0
public final @NonNull WeightedElementsComplicationData.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 WeightedElementsComplicationData.Builder setText(ComplicationText text)

Sets optional text associated with the complication data.

setTitle

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

Sets optional title associated with the complication data.

setValidTimeRange

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

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