GridItem

public final class GridItem
extends Object implements Item

java.lang.Object
   ↳ androidx.car.app.model.GridItem


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

Summary

Nested classes

class GridItem.Builder

A builder of GridItem

Constants

int IMAGE_TYPE_ICON

Represents an icon to be displayed in the grid item.

int IMAGE_TYPE_LARGE

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

Public methods

boolean equals(Object other)
CarIcon getImage()

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

int getImageType()

Returns the image type of the grid item.

OnClickDelegate getOnClickDelegate()

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

CarText getText()

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

CarText getTitle()

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

int hashCode()
boolean isLoading()

Returns whether the grid item is in a loading state.

String toString()

Inherited methods

Constants

IMAGE_TYPE_ICON

public static final int IMAGE_TYPE_ICON

Represents an icon to be displayed in the grid item.

If necessary, icons will be scaled down to fit within a 64 x 64 dp bounding box, preserving their aspect ratios.

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

Constant Value: 1 (0x00000001)

IMAGE_TYPE_LARGE

public static final int IMAGE_TYPE_LARGE

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

If necessary, these images will be scaled down to fit within a 64 x 64 dp bounding box, preserving their aspect ratio.

Constant Value: 2 (0x00000002)

Public methods

equals

public boolean equals (Object other)

Parameters
other Object

Returns
boolean

getImage

public CarIcon getImage ()

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

Returns
CarIcon

getImageType

public int getImageType ()

Returns the image type of the grid item.

Returns
int

getOnClickDelegate

public OnClickDelegate getOnClickDelegate ()

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

Returns
OnClickDelegate

getText

public CarText getText ()

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

Returns
CarText

getTitle

public CarText getTitle ()

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

Returns
CarText

hashCode

public int hashCode ()

Returns
int

isLoading

public boolean isLoading ()

Returns whether the grid item is in a loading state.

Returns
boolean

toString

public String toString ()

Returns
String