Section.BaseBuilder


protected abstract class Section.BaseBuilder<T extends Item, B>

Known direct subclasses
GridSection.Builder

A builder that constructs GridSection instances.

RowSection.Builder

A builder that constructs RowSection instances.


Generic Section builder that contains the fields that all sections share.

Parameters
<T extends Item>

The Item type that this section contains

<B>

The builder type to return for the builder methods

Summary

Protected constructors

Public methods

@NonNull B

Adds an item to this section, appending to the existing list of items.

@NonNull B

Delete all items in this section.

@NonNull B

Sets the items for this section, overwriting any other previously set items.

@NonNull B

Sets or clears the optional message to display in this section when there are 0 items added to it.

@NonNull B

Sets or clears the optional message to display in this section when there are 0 items added to it.

@NonNull B

Sets the OnItemVisibilityChangedListener to call when the visible items in this Section changes.

@NonNull B

Sets 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

BaseBuilder

Added in 1.7.0
protected BaseBuilder()

Public methods

addItem

Added in 1.7.0
@CanIgnoreReturnValue
public @NonNulladdItem(@NonNull T item)

Adds an item to this section, appending to the existing list of items.

clearItems

Added in 1.7.0
@CanIgnoreReturnValue
public @NonNullclearItems()

Delete all items in this section.

setItems

Added in 1.7.0
@CanIgnoreReturnValue
public @NonNullsetItems(@NonNull List<T> items)

Sets the items for this section, overwriting any other previously set items.

setNoItemsMessage

Added in 1.7.0
@CanIgnoreReturnValue
public @NonNullsetNoItemsMessage(@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

Added in 1.7.0
@CanIgnoreReturnValue
public @NonNullsetNoItemsMessage(@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

Added in 1.8.0-alpha01
@CanIgnoreReturnValue
public @NonNullsetOnItemVisibilityChangedListener(
    @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

Added in 1.7.0
@CanIgnoreReturnValue
public @NonNullsetTitle(@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

Added in 1.7.0
@CanIgnoreReturnValue
public @NonNullsetTitle(@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.