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.BuilderA builder of |
Constants |
|
|---|---|
static final int |
IMAGE_TYPE_ICON = 1Represents an icon to be displayed in the grid item. |
static final int |
IMAGE_TYPE_LARGE = 2Represents a large image to be displayed in the grid item. |
Public methods |
|
|---|---|
boolean |
|
@Nullable Badge |
Returns the |
@Nullable CarIcon |
getImage()Returns the image of the grid item or |
int |
Returns the image type of the grid item. |
@Nullable OnClickDelegate |
Returns the |
@Nullable CarText |
getText()Returns the text to display below the title or |
@Nullable CarText |
getTitle()Returns the title of the grid item or |
int |
hashCode() |
boolean |
Returns whether this item can be included in indexed lists. |
boolean |
Returns whether the grid item is in a loading state. |
@NonNull String |
toString() |
Constants
IMAGE_TYPE_ICON
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
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
getBadge
@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
public @Nullable CarIcon getImage()
Returns the image of the grid item or null if not set.
| See also | |
|---|---|
setImage |
getOnClickDelegate
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
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
public @Nullable CarText getTitle()
Returns the title of the grid item or null if not set.
| See also | |
|---|---|
setTitle |
isIndexable
@ExperimentalCarApi
public boolean isIndexable()
Returns whether this item can be included in indexed lists.
| See also | |
|---|---|
setIndexable |
isLoading
public boolean isLoading()
Returns whether the grid item is in a loading state.
| See also | |
|---|---|
setLoading |