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 |
|---|
@ExperimentalCarApiA builder that constructs |
Constants |
|
|---|---|
static final int |
Indicate that alphabetical indexing should not be available for the template which also disables any UI accelerators that the user may be shown to help the user navigate larger lists. |
static final int |
Indicates that alphabetical indexing should use the item's title as-is with no processing. |
static final int |
Indicates that alphabetical indexing should ignore English articles (like "the", "an", and "a") as well as non-alphanumeric symbols. |
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. |
int |
Returns the alphabetical indexing strategy. |
@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 |
hashCode() |
boolean |
This method is deprecated. use |
boolean |
Returns whether or not this template is in a loading state. |
@NonNull String |
toString() |
Constants
ALPHABETICAL_INDEXING_DISABLED
public static final int ALPHABETICAL_INDEXING_DISABLED = 0
Indicate that alphabetical indexing should not be available for the template which also disables any UI accelerators that the user may be shown to help the user navigate larger lists.
This is the default behavior if not explicitly set.
ALPHABETICAL_INDEXING_TITLE_AS_IS
public static final int ALPHABETICAL_INDEXING_TITLE_AS_IS = 1
Indicates that alphabetical indexing should use the item's title as-is with no processing.
Note that a UI accelerator may still group the item under the "miscellaneous" category if the title starts with a non-alphabetical character.
ALPHABETICAL_INDEXING_TITLE_IGNORE_ARTICLES_AND_SYMBOLS
public static final int ALPHABETICAL_INDEXING_TITLE_IGNORE_ARTICLES_AND_SYMBOLS = 2
Indicates that alphabetical indexing should ignore English articles (like "the", "an", and "a") as well as non-alphanumeric symbols.
Note this will not change the display of the item's title, just how it's sorted. For example, "The Example Song" will continue to show up as "The Example Song", but will be sorted into the "E" bucket.
SCROLL_STATE_PRESERVE_INDEX
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
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
getActions
public @NonNull List<Action> getActions()
Returns the list of actions that should appear alongside the content of this template.
getAlphabeticalIndexingStrategy
public int getAlphabeticalIndexingStrategy()
Returns the alphabetical indexing strategy.
"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.
Individual items may be excluded from the list by setting their #isIndexable field to false.
getHeader
public @Nullable Header getHeader()
Returns the optional header for this template.
getScrollStatePersistenceStrategy
public int getScrollStatePersistenceStrategy()
Returns the strategy to use when this template is used as a refresh. See setScrollStatePersistenceStrategy
getSections
public @NonNull List<Section<Object>> getSections()
Returns the list of sections within this template.
isAlphabeticalIndexingAllowed
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