Section.BaseBuilder
protected abstract class Section.BaseBuilder<T extends Item, B>
GridSection.Builder |
A builder that constructs |
RowSection.Builder |
A builder that constructs |
Generic Section builder that contains the fields that all sections share.
| Parameters | |
|---|---|
<T extends Item> |
The |
<B> |
The builder type to return for the builder methods |
Summary
Protected constructors |
|---|
Public methods |
|
|---|---|
@NonNull B |
@CanIgnoreReturnValueAdds an item to this section, appending to the existing list of items. |
@NonNull B |
Delete all items in this section. |
@NonNull B |
@CanIgnoreReturnValueSets the items for this section, overwriting any other previously set items. |
@NonNull B |
@CanIgnoreReturnValueSets or clears the optional message to display in this section when there are 0 items added to it. |
@NonNull B |
@CanIgnoreReturnValueSets or clears the optional message to display in this section when there are 0 items added to it. |
@NonNull B |
@CanIgnoreReturnValueSets the |
@NonNull B |
@CanIgnoreReturnValueSets or clears the optional title that appears above the items in this section. |
@NonNull B |
Sets or clears the optional title that appears above the items in this section. |
Protected constructors
Public methods
addItem
@CanIgnoreReturnValue
public @NonNull B addItem(@NonNull T item)
Adds an item to this section, appending to the existing list of items.
clearItems
@CanIgnoreReturnValue
public @NonNull B clearItems()
Delete all items in this section.
setItems
@CanIgnoreReturnValue
public @NonNull B setItems(@NonNull List<T> items)
Sets the items for this section, overwriting any other previously set items.
setNoItemsMessage
@CanIgnoreReturnValue
public @NonNull B setNoItemsMessage(@Nullable CarText noItemsMessage)
Sets or clears the optional message to display in this section when there are 0 items added to it. If not set, this section will not show any message when there are 0 items. The message must conform to TEXT_ONLY constraints.
setNoItemsMessage
@CanIgnoreReturnValue
public @NonNull B setNoItemsMessage(@Nullable CharSequence noItemsMessage)
Sets or clears the optional message to display in this section when there are 0 items added to it. If not set, this section will not show any message when there are 0 items. The message must conform to TEXT_ONLY constraints.
setOnItemVisibilityChangedListener
@CanIgnoreReturnValue
public @NonNull B setOnItemVisibilityChangedListener(
@Nullable ItemList.OnItemVisibilityChangedListener onItemVisibilityChangedListener
)
Sets the OnItemVisibilityChangedListener to call when the visible items in this Section changes.
Note that the listener relates to UI events and will be executed on the main thread using Looper#getMainLooper().
It's possible for more than 1 Section to be visible on the screen at the same time, in which case, every visible Section's OnItemVisibilityChangedListener will be triggered with their respective visible items.
Passing null will clear the OnItemVisibilityChangedListener.
setTitle
@CanIgnoreReturnValue
public @NonNull B setTitle(@Nullable CarText title)
Sets or clears the optional title that appears above the items in this section. If not set, no title shows up. The title must conform to TEXT_ONLY constraints.
setTitle
@CanIgnoreReturnValue
public @NonNull B setTitle(@Nullable CharSequence title)
Sets or clears the optional title that appears above the items in this section. If not set, no title shows up. The title must conform to TEXT_ONLY constraints.