GridItem


@CarProtocol
public final class GridItem implements Item


Represents a grid item with an image and an optional title.

Summary

Nested types

public final class GridItem.Builder

A builder of GridItem.

Constants

static final int

Represents an icon to be displayed in the grid item.

static final int

Represents a large image to be displayed in the grid item.

Public methods

boolean
@Nullable Badge

Returns the Badge that is displayed over the grid item image or null if not set.

@Nullable CarIcon

Returns the image of the grid item or null if not set.

int

Returns the image type of the grid item.

@Nullable OnClickDelegate

Returns the OnClickDelegate to be called back when the grid item is clicked or null if the grid item is non-clickable.

@Nullable CarText

Returns the text to display below the title or null if no text will be displayed below the title.

@Nullable CarText

Returns the title of the grid item or null if not set.

int
boolean

Returns whether this item can be included in indexed lists.

boolean

Returns whether the grid item is in a loading state.

@NonNull String

Constants

IMAGE_TYPE_ICON

Added in 1.0.0
public static final int IMAGE_TYPE_ICON = 1

Represents an icon to be displayed in the grid item.

To minimize scaling artifacts across a wide range of car screens, apps should provide icons targeting a 128 x 128 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 grid item.

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

Public methods

equals

public boolean equals(@Nullable Object other)

getBadge

Added in 1.4.0
@ExperimentalCarApi
public @Nullable Badge getBadge()

Returns the Badge that is displayed over the grid item image or null if not set.

See also
GridItem.Builder

getImage

Added in 1.0.0
public @Nullable CarIcon getImage()

Returns the image of the grid item or null if not set.

See also
setImage

getImageType

Added in 1.0.0
public int getImageType()

Returns the image type of the grid item.

getOnClickDelegate

Added in 1.0.0
public @Nullable OnClickDelegate getOnClickDelegate()

Returns the OnClickDelegate to be called back when the grid item is clicked or null if the grid item is non-clickable.

getText

Added in 1.0.0
public @Nullable CarText getText()

Returns the text to display below the title or null if no text will be displayed below the title.

See also
setText

getTitle

Added in 1.0.0
public @Nullable CarText getTitle()

Returns the title of the grid item or null if not set.

See also
setTitle

hashCode

public int hashCode()

isIndexable

Added in 1.7.0-beta03
@ExperimentalCarApi
public boolean isIndexable()

Returns whether this item can be included in indexed lists.

See also
setIndexable

isLoading

Added in 1.0.0
public boolean isLoading()

Returns whether the grid item is in a loading state.

See also
setLoading

toString

public @NonNull String toString()