GridTemplate


@CarProtocol
public final class GridTemplate implements Template


A template representing a grid of items.

Template Restrictions In regards to template refreshes, as described in onGetTemplate, this template is considered a refresh of a previous one if:
  • The previous template is in a loading state (see setLoading, or
  • The template title has not changed, and the number of grid items and the title of each grid item have not changed.

Summary

Nested types

public final class GridTemplate.Builder

A builder of GridTemplate.

Constants

static final int

Represents a preference to crop all grid item images into the shape of a circle.

static final int

Represents a preference to keep the images as-is without modifying their shape.

static final int

Represents a large size for all grid items within a template.

static final int

Represents a medium size for all grid items within a template.

static final int

Represents a small size for all grid items within a template.

Public methods

boolean
@Nullable ActionStrip

This method is deprecated.

use getEndHeaderActions instead.

@NonNull List<Action>

Returns the list of additional actions.

@Nullable Header

Returns the Header to display in this template.

@Nullable Action

This method is deprecated.

use getStartHeaderAction instead.

int

Returns the item image shape.

int

Returns the grid item size, which applies to all grid items in the template.

@Nullable ItemList

Returns the ItemList instance that contains the grid items to display or null if not set.

@Nullable CarText

This method is deprecated.

use getTitle instead.

int
boolean

Returns whether the template is loading.

@NonNull String

Constants

ITEM_IMAGE_SHAPE_CIRCLE

Added in 1.4.0
@ExperimentalCarApi
public static final int ITEM_IMAGE_SHAPE_CIRCLE = 2

Represents a preference to crop all grid item images into the shape of a circle.

ITEM_IMAGE_SHAPE_UNSET

Added in 1.4.0
@ExperimentalCarApi
public static final int ITEM_IMAGE_SHAPE_UNSET = 1

Represents a preference to keep the images as-is without modifying their shape.

This is the default setting.

ITEM_SIZE_LARGE

Added in 1.4.0
@ExperimentalCarApi
public static final int ITEM_SIZE_LARGE = 4

Represents a large size for all grid items within a template.

See also
setItemSize

ITEM_SIZE_MEDIUM

Added in 1.4.0
@ExperimentalCarApi
public static final int ITEM_SIZE_MEDIUM = 2

Represents a medium size for all grid items within a template.

See also
setItemSize

ITEM_SIZE_SMALL

Added in 1.4.0
@ExperimentalCarApi
public static final int ITEM_SIZE_SMALL = 1

Represents a small size for all grid items within a template. This is the default size.

See also
setItemSize

Public methods

equals

public boolean equals(@Nullable Object other)

getActionStrip

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @Nullable ActionStrip getActionStrip()

Returns the ActionStrip for this template or null if not set.

See also
setActionStrip

getActions

Added in 1.4.0
@ExperimentalCarApi
@RequiresCarApi(value = 7)
public @NonNull List<ActiongetActions()

Returns the list of additional actions.

See also
addAction

getHeader

Added in 1.7.0-beta03
public @Nullable Header getHeader()

Returns the Header to display in this template.

This method was introduced in API 7, but is backwards compatible even if the client is using API 6 or below.

See also
setHeader

getHeaderAction

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @Nullable Action getHeaderAction()

Returns the Action that is set to be displayed in the header of the template, or null if not set.

See also
setHeaderAction

getItemImageShape

Added in 1.4.0
@ExperimentalCarApi
public int getItemImageShape()

Returns the item image shape.

All item images in the grid are cropped into the specified shape.

getItemSize

Added in 1.4.0
@ExperimentalCarApi
public int getItemSize()

Returns the grid item size, which applies to all grid items in the template.

See also
setItemSize

getSingleList

Added in 1.0.0
public @Nullable ItemList getSingleList()

Returns the ItemList instance that contains the grid items to display or null if not set.

See also
setSingleList

getTitle

Added in 1.0.0
Deprecated in 1.7.0-beta03
public @Nullable CarText getTitle()

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

See also
setTitle

hashCode

public int hashCode()

isLoading

Added in 1.0.0
public boolean isLoading()

Returns whether the template is loading.

See also
setLoading

toString

public @NonNull String toString()