SectionedItemTemplate


@RequiresCarApi(value = 8)
@CarProtocol
@ExperimentalCarApi
public final class SectionedItemTemplate implements Template


A template that contains sections of items like rows, grid items, etc.

Summary

Nested types

A builder that constructs SectionedItemTemplate instances.

Constants

static final int

Indicate that the scroll position should be preserved by scrolling back down to the same index that the user had scrolled to.

static final int

Indicate that the scroll position should reset back to the top when this template is refreshed.

Public methods

boolean
@NonNull List<Action>

Returns the list of actions that should appear alongside the content of this template.

@Nullable Header

Returns the optional header for this template.

int

Returns the strategy to use when this template is used as a refresh.

@NonNull List<Section<Object>>

Returns the list of sections within this template.

int
boolean

Returns whether this list can be indexed alphabetically, by item title.

boolean

Returns whether or not this template is in a loading state.

@NonNull String

Constants

SCROLL_STATE_PRESERVE_INDEX

Added in 1.8.0-alpha02
public static final int SCROLL_STATE_PRESERVE_INDEX = 1

Indicate that the scroll position should be preserved by scrolling back down to the same index that the user had scrolled to.

If the index no longer exists, the scroll position will be set to the bottom of the new list.

SCROLL_STATE_RESET_TO_TOP

Added in 1.8.0-alpha02
public static final int SCROLL_STATE_RESET_TO_TOP = 0

Indicate that the scroll position should reset back to the top when this template is refreshed.

This is the default behavior if not explicitly set.

Public methods

equals

public boolean equals(@Nullable Object other)

getActions

Added in 1.7.0
public @NonNull List<ActiongetActions()

Returns the list of actions that should appear alongside the content of this template.

getHeader

Added in 1.7.0
public @Nullable Header getHeader()

Returns the optional header for this template.

getScrollStatePersistenceStrategy

Added in 1.8.0-alpha02
public int getScrollStatePersistenceStrategy()

Returns the strategy to use when this template is used as a refresh. See setScrollStatePersistenceStrategy

getSections

Added in 1.7.0
public @NonNull List<Section<Object>> getSections()

Returns the list of sections within this template.

hashCode

public int hashCode()

isAlphabeticalIndexingAllowed

Added in 1.7.0
public boolean isAlphabeticalIndexingAllowed()

Returns whether this list can be indexed alphabetically, by item title.

"Indexing" refers to the process of examining list contents (e.g. item titles) to sort, partition, or filter a list. Indexing is generally used for features called "Accelerators", which allow a user to quickly find a particular Item in a long list.

To exclude a single item from indexing, see the relevant item's API.

To enable/disable accelerators for the entire list, see setAlphabeticalIndexingAllowed

isLoading

Added in 1.7.0
public boolean isLoading()

Returns whether or not this template is in a loading state.

toString

public @NonNull String toString()