RichTextElement

open class RichTextElement : VersionedParcelable
kotlin.Any
   ↳ androidx.car.cluster.navigation.RichTextElement

An item in a RichText sequence, acting as a union of different graphic elements that can be displayed one after another.

A RichTextElement can contain text and a graphic element as its representation. Consumers must attempt to render the graphic element if present. In case of failure to render the element, the first line of fallback should be getText(). If that is also empty, fallback to RichText#getText() will be used.

New graphic element types might be added in the future. If such elements are unknown to the consumer, they will be delivered to the consumer as just text.

Summary

Nested classes

Builder for creating a RichTextElement

Public methods

open Boolean
equals(other: Any?)

open ImageReference?

Returns an image representing this element.

open String

Returns the textual representation of this element.

open Int

open String

Public methods

equals

open fun equals(other: Any?): Boolean

getImage

@Nullable open fun getImage(): ImageReference?

Returns an image representing this element. This representation should be used over the textual representation getText() whenever possible.

In case of failure to render, initial fallback to getText() should be used. Fallback to RichText#getText() should be used if textual fallback is not provided (empty string).

getText

@NonNull open fun getText(): String

Returns the textual representation of this element.

If getImage() is provided, then this is used as a fallback in the case of render failures.

hashCode

open fun hashCode(): Int

toString

open fun toString(): String