LongTextComplicationData


public final class LongTextComplicationData extends ComplicationData


Type used for complications where the primary piece of data is a piece of text. The text may be accompanied by an icon and/or a title.

The text is expected to always be displayed.

The title, if provided, it is expected that this field will be displayed.

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.

A data source that wants to serve a LongTextComplicationData must include the following meta data in its manifest (NB the value is a comma separated list):

<meta-data android:name="android.support.wearable.complications.SUPPORTED_TYPES"
android:value="LONG_TEXT"/>

Summary

Nested types

Builder for LongTextComplicationData.

Public fields

static final @NonNull ComplicationType

The ComplicationType corresponding to objects of this type.

Public methods

final ComplicationText

The content description field for accessibility.

final MonochromaticImage

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

@NonNull Instant

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

final SmallImage

A SmallImage that is expected to cover a small fraction of a watch face occupied by a single complication.

final @NonNull ComplicationText

The body ComplicationText of the complication.

final ComplicationText

The optional title ComplicationText.

boolean

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

@NonNull String

Inherited methods

From androidx.wear.watchface.complications.data.ComplicationData
boolean
equals(Object other)
final ComponentName

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

final int

The display policy for this complication.

final ComplicationData

Used in case any dynamic value has been invalidated.

final int

The persistence policy for this complication.

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.

int
final void
setTapActionLostDueToSerialization(
    boolean tapActionLostDueToSerialization
)

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

Public fields

TYPE

public static final @NonNull ComplicationType TYPE

The ComplicationType corresponding to objects of this type.

Public methods

getContentDescription

Added in 1.0.0
public final ComplicationText getContentDescription()

The content description field for accessibility.

getMonochromaticImage

Added in 1.0.0
public final MonochromaticImage getMonochromaticImage()

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.

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.

getSmallImage

Added in 1.0.0
public final SmallImage getSmallImage()

A SmallImage that is expected to cover a small fraction of a watch face occupied by a single complication. If the smallImage is equal to SmallImage.PLACEHOLDER the renderer must treat it as a placeholder rather than rendering normally, its suggested it should be rendered as a light grey box.

getText

Added in 1.0.0
public final @NonNull ComplicationText getText()

The body ComplicationText of the complication. 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.

getTitle

Added in 1.0.0
public final ComplicationText getTitle()

The optional title ComplicationText. 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.

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.

toString

public @NonNull String toString()