Class CarGridTemplate

java.lang.Object
com.codename1.car.CarTemplate
com.codename1.car.CarGridTemplate

public class CarGridTemplate extends CarTemplate
A grid of image-forward CarGridItems -- browse categories, station presets, playlist artwork. Maps to androidx.car.app.model.GridTemplate and CPGridTemplate (which itself caps the grid, typically at eight buttons; see CarContext#getGridItemLimit()).
  • Constructor Details

    • CarGridTemplate

      public CarGridTemplate()
  • Method Details

    • setTitle

      public CarGridTemplate setTitle(String title)

      Sets the header title.

      Parameters
      • title: the header title
      Returns

      this template, for chaining

    • addItem

      public CarGridTemplate addItem(CarGridItem item)

      Adds an item to the grid.

      Parameters
      • item: the grid item to add
      Returns

      this template, for chaining

    • getItems

      public List<CarGridItem> getItems()
      Returns the grid items, in order.
    • getHeaderActions

      public CarActionStrip getHeaderActions()
      Returns the header action strip, or null.
    • setHeaderActions

      public CarGridTemplate setHeaderActions(CarActionStrip headerActions)

      Sets the header action strip.

      Parameters
      • headerActions: the action strip
      Returns

      this template, for chaining

    • isLoading

      public boolean isLoading()
      Returns true when the grid should render a loading spinner instead of content.
    • setLoading

      public CarGridTemplate setLoading(boolean loading)

      Marks the template as loading; the head unit renders a spinner.

      Parameters
      • loading: true to show a spinner
      Returns

      this template, for chaining