LayoutTextContentItem

class LayoutTextContentItem(layout: Layout, val text: CharSequence, val fullText: CharSequence, isExplicitlyTruncated: Boolean, val color: Int = layout.paint.color, isMounted: () -> Boolean = { true }) : TextContent.Item

A TextContent.Item read from the Layout a text component draws, shared by Litho's legacy text drawable and RenderCore's text view so both report text the same way.

Parameters

text

the text that is mounted; for a custom ellipsis, the already-truncated string.

fullText

the text the component was given, before any truncation.

isExplicitlyTruncated

whether the component pre-truncated the text for a custom ellipsis.

color

the color the text is drawn in, when it differs from the layout's paint.

isMounted

whether layout is still the one the component draws; span bounds are empty once it isn't, as they were before this class was shared.

Constructors

Link copied to clipboard
constructor(layout: Layout, text: CharSequence, fullText: CharSequence, isExplicitlyTruncated: Boolean, color: Int = layout.paint.color, isMounted: () -> Boolean = { true })

Types

Link copied to clipboard
object Companion

Properties

Link copied to clipboard
open override val color: Int
Link copied to clipboard
open override val displayedText: CharSequence

The text actually drawn on screen. For a standard ellipsize the ellipsized run is replaced with the ellipsis glyph ("…"), reconstructed from the layout's per-line ellipsis metadata (getEllipsisStart/getEllipsisCount) — exactly the substitution the platform makes when drawing the line. For a custom ellipsis it is the pre-truncated text with the custom ellipsis already baked in. Equals fullText when nothing is truncated.

Link copied to clipboard
open override val fontLineHeight: Float
Link copied to clipboard
open override val fullText: CharSequence
Link copied to clipboard
open override val isTruncated: Boolean

Whether this item's content is truncated — i.e. the text actually drawn (displayedText) differs from the complete text (fullText). Covers a standard maxLines + ellipsize truncation and a custom ellipsis (e.g. "… See more"), including the framework bug that re-ellipsizes a custom ellipsis.

Link copied to clipboard
open override val linesCount: Int
Link copied to clipboard
Link copied to clipboard
open override val text: CharSequence
Link copied to clipboard
open override val textSize: Float
Link copied to clipboard
open override val typeface: Typeface?