Stay organized with collections Save and categorize content based on your preferences.

DiscreteRangedValueComplicationData

@ComplicationExperimental
public final class DiscreteRangedValueComplicationData extends ComplicationData


Type used for complications including a discrete integer value within a range. E.g. 3 out of 6 daily cups of water drunk. The value may be accompanied by an icon and/or short text and title.

The value, min, and max fields are required for this type and the value within the range is expected to always be displayed.

The icon, title, and text fields are optional and the watch face may choose which of these fields to display, if any.

Unlike RangedValueComplicationData, DiscreteRangedValueComplicationData doesn't specify a color ramp, this is because the ranged value is expected to be rendered using solid colored segments with watch face selected colors.

If a monochromaticImage and a smallImage are both specified then only one should be displayed. If the complication is drawn with a single color it's recommended to choose monochromaticImage and apply a tint. If the complication is rendered with multiple colors it's recommended to choose the smallImage. It's best practice for a ComplicationDataSource to specify both a monochromaticImage and a smallImage.

Summary

Public fields

final ComplicationText

The content description field for accessibility.

final int

The maximum Int value for this complication.

final int

The minimum Int value for this complication.

final MonochromaticImage

A simple MonochromaticImage image that can be tinted by the watch face.

final SmallImage
final ComplicationText

The body ComplicationText of the complication.

final ComplicationText

The optional title ComplicationText.

final int

The Int value of this complication which is >= min and <= max or equal to PLACEHOLDER.

Public methods

boolean
equals(Object other)
@NonNull Instant

Returns the next Instant after afterInstant at which any field of the complication may change.

boolean

Returns true if any of the fields of this ComplicationData are placeholders.

int
@NonNull String

Inherited fields

From androidx.wear.watchface.complications.data.ComplicationData
final ComponentName

The ComponentName of the androidx.wear.watchface.complications.datasource.ComplicationDataSourceService that provided the ComplicationData.

final PendingIntent

The PendingIntent to send when the complication is tapped on.

final boolean

tapAction which is a PendingIntent unfortunately can't be serialized.

final @NonNull ComplicationType

The ComplicationType of this complication data.

final @NonNull TimeRange

The TimeRange within which the complication should be displayed.

Public fields

contentDescription

public final ComplicationText contentDescription

The content description field for accessibility.

max

public final int max

The maximum Int value for this complication.

min

public final int min

The minimum Int value for this complication.

monochromaticImage

public final MonochromaticImage monochromaticImage

A simple MonochromaticImage image that can be tinted by the watch face. If the monochromaticImage is equal to MonochromaticImage.PLACEHOLDER the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

smallImage

public final SmallImage smallImage

text

public final ComplicationText text

The body ComplicationText of the complication. The length of the text, including any time-dependent values at any valid time, is expected to not exceed seven characters. When using this text, the watch face should be able to display any string of up to seven characters (reducing the text size appropriately if the string is very wide). Although not expected, it is possible that strings of more than seven characters might be seen, in which case they may be truncated. If the text is equal to ComplicationText.PLACEHOLDER the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

title

public final ComplicationText title

The optional title ComplicationText. The length of the title, including any time-dependent values at any valid time, is expected to not exceed seven characters. When using this text, the watch face should be able to display any string of up to seven characters (reducing the text size appropriately if the string is very wide). Although not expected, it is possible that strings of more than seven characters might be seen, in which case they may be truncated. If the title is equal to ComplicationText.PLACEHOLDER the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

value

public final int value

The Int value of this complication which is >= min and <= max or equal to PLACEHOLDER. If it's equal to PLACEHOLDER the renderer must treat it as a placeholder rather than rendering normally, its suggested to be drawn as a grey arc with a percentage value selected by the renderer.

Public methods

equals

public boolean equals(Object other)

getNextChangeInstant

public @NonNull Instant getNextChangeInstant(@NonNull Instant afterInstant)

Returns the next Instant after afterInstant at which any field of the complication may change. If there's no scheduled changes then Instant.MAX will be returned.

See ComplicationText.getNextChangeTime

Parameters
@NonNull Instant afterInstant

The reference Instant, after which changes will be reported.

hasPlaceholderFields

public boolean hasPlaceholderFields()

Returns true if any of the fields of this ComplicationData are placeholders. I.e. if any fields are equal to: ComplicationText.PLACEHOLDER, SmallImage.PLACEHOLDER, MonochromaticImage.PLACEHOLDER, PhotoImageComplicationData.PLACEHOLDER, or RangedValueComplicationData.PLACEHOLDER.

hashCode

public int hashCode()

toString

public @NonNull String toString()