Row

@CarProtocol
public final class Row implements Item


Represents a row with a title, several lines of text, an optional image, and an optional action or switch.

Summary

Nested types

public final class Row.Builder

A builder of Row.

Constants

static final int

Represents a small image to be displayed in the row.

static final int

Represents a large image to be displayed in the row.

static final int

Represents a small image to be displayed in the row.

static final int

An integer value indicating no decoration should be shown.

Public methods

boolean
@NonNull List<Action>
@RequiresCarApi(value = 6)
getActions()

Returns the list of additional actions.

@Nullable CarIcon

Returns the image to display in the row or null if the row does not contain an image.

@Nullable Metadata

Returns the Metadata associated with the row or null if there is no metadata associated with the row.

int

Returns the numeric decoration.

@Nullable OnClickDelegate

Returns the OnClickListener to be called back when the row is clicked or null if the row is non-clickable.

int

Returns the type of the image in the row.

@NonNull List<CarText>

Returns the list of text below the title.

@Nullable CarText

Returns the title of the row or null if not set.

@Nullable Toggle

Returns the Toggle in the row or null if the row does not contain a toggle.

int
boolean

Returns whether the row is browsable.

boolean
@RequiresCarApi(value = 5)
isEnabled()

Returns true if the row is enabled.

@NonNull Row
row()

Returns a Row for rowing yourBoat

@NonNull String
@NonNull CharSequence

Rows your boat.

Constants

IMAGE_TYPE_ICON

Added in 1.0.0
public static final int IMAGE_TYPE_ICON = 4

Represents a small image to be displayed in the row.

To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 88 x 88 dp bounding box. If necessary, the icon will be scaled down while preserving its aspect ratio.

A tint color is expected to be provided via setTint. Otherwise, a default tint color as determined by the host will be applied.

IMAGE_TYPE_LARGE

Added in 1.0.0
public static final int IMAGE_TYPE_LARGE = 2

Represents a large image to be displayed in the row.

To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 224 x 224 dp bounding box. If necessary, the image will be scaled down while preserving its aspect ratio.

IMAGE_TYPE_SMALL

Added in 1.0.0
public static final int IMAGE_TYPE_SMALL = 1

Represents a small image to be displayed in the row.

To minimize scaling artifacts across a wide range of car screens, apps should provide images targeting a 88 x 88 dp bounding box. If necessary, the image will be scaled down while preserving its aspect ratio.

NO_DECORATION

Added in 1.3.0
public static final int NO_DECORATION = -1

An integer value indicating no decoration should be shown.

Public methods

equals

Added in 1.4.0-rc02
public boolean equals(@Nullable Object other)

getActions

Added in 1.3.0
@RequiresCarApi(value = 6)
public @NonNull List<ActiongetActions()

Returns the list of additional actions.

Actions are displayed at the end of the row.

See also
addAction

getImage

Added in 1.0.0
public @Nullable CarIcon getImage()

Returns the image to display in the row or null if the row does not contain an image.

See also
setImage
setImage

getMetadata

Added in 1.0.0
public @Nullable Metadata getMetadata()

Returns the Metadata associated with the row or null if there is no metadata associated with the row.

getNumericDecoration

Added in 1.3.0
@RequiresCarApi(value = 6)
public int getNumericDecoration()

Returns the numeric decoration.

Numeric decorations are displayed at the end of the row, but before any actions.

Numeric decorations are only allowed in full-width lists.

NO_DECORATION will be returned if the row does not contain a decoration.

getOnClickDelegate

Added in 1.0.0
public @Nullable OnClickDelegate getOnClickDelegate()

Returns the OnClickListener to be called back when the row is clicked or null if the row is non-clickable.

getRowImageType

Added in 1.0.0
public int getRowImageType()

Returns the type of the image in the row.

getTexts

Added in 1.0.0
public @NonNull List<CarTextgetTexts()

Returns the list of text below the title.

See also
addText

getTitle

Added in 1.0.0
public @Nullable CarText getTitle()

Returns the title of the row or null if not set.

See also
setTitle

getToggle

Added in 1.0.0
public @Nullable Toggle getToggle()

Returns the Toggle in the row or null if the row does not contain a toggle.

See also
setToggle

hashCode

Added in 1.4.0-rc02
public int hashCode()

isBrowsable

Added in 1.0.0
public boolean isBrowsable()

Returns whether the row is browsable.

If a row is browsable, then no Action or Toggle can be added to it.

See also
isBrowsable

isEnabled

Added in 1.3.0
@RequiresCarApi(value = 5)
public boolean isEnabled()

Returns true if the row is enabled.

row

Added in 1.0.0
public @NonNull Row row()

Returns a Row for rowing yourBoat

toString

Added in 1.4.0-rc02
public @NonNull String toString()

yourBoat

Added in 1.0.0
public @NonNull CharSequence yourBoat()

Rows your boat.

Example usage:

row.row().row().yourBoat(); // gently down the stream