SectionHeader.Builder


public final class SectionHeader.Builder


A builder of SectionHeader.

Summary

Public constructors

Returns a Builder instance configured with the given title.

Returns a Builder instance configured with the given title.

Public methods

@NonNull SectionHeader

Builds the SectionHeader.

@NonNull SectionHeader.Builder

Clears the subtitle of the header.

@NonNull SectionHeader.Builder

Sets the end icon of the header.

@NonNull SectionHeader.Builder

Sets the click listener for the header.

@NonNull SectionHeader.Builder

Sets the start icon of the header with a default size of IMAGE_TYPE_SMALL.

@NonNull SectionHeader.Builder
@CanIgnoreReturnValue
setStartIcon(@NonNull CarIcon startIcon, int startIconType)

Sets the start icon of the header and its size type.

@NonNull SectionHeader.Builder

Sets the subtitle of the header.

@NonNull SectionHeader.Builder

Sets the subtitle of the header.

Public constructors

Builder

Added in 1.8.0
public Builder(@NonNull CarText title)

Returns a Builder instance configured with the given title.

The title must be a plain string with no spans other than those supported by TEXT_ONLY.

Throws
java.lang.NullPointerException

if title is null

java.lang.IllegalArgumentException

if title contains unsupported spans

Builder

Added in 1.8.0
public Builder(@NonNull CharSequence title)

Returns a Builder instance configured with the given title.

The title must be a plain string with no spans other than those supported by TEXT_ONLY.

Throws
java.lang.NullPointerException

if title is null

java.lang.IllegalArgumentException

if title contains unsupported spans

See also
CarText

Public methods

build

Added in 1.8.0
public @NonNull SectionHeader build()

Builds the SectionHeader.

Throws
java.lang.IllegalStateException

if a title has not been set

clearSubtitle

Added in 1.9.0-alpha01
@CanIgnoreReturnValue
public @NonNull SectionHeader.Builder clearSubtitle()

Clears the subtitle of the header.

Returns
@NonNull SectionHeader.Builder

this builder to help chaining

setEndIcon

Added in 1.8.0
@CanIgnoreReturnValue
public @NonNull SectionHeader.Builder setEndIcon(@NonNull CarIcon endIcon)

Sets the end icon of the header.

Only custom icon types (e.g. TYPE_CUSTOM) are supported.

Parameters
@NonNull CarIcon endIcon

the CarIcon to display after the title

Throws
java.lang.NullPointerException

if endIcon is null

java.lang.IllegalArgumentException

if endIcon is not a custom icon, or if it does not meet the DEFAULT constraints

setOnClickListener

Added in 1.8.0
@CanIgnoreReturnValue
public @NonNull SectionHeader.Builder setOnClickListener(@NonNull OnClickListener onClickListener)

Sets the click listener for the header.

If a listener is set, the header will become focusable and clickable.

Throws
java.lang.NullPointerException

if onClickListener is null

setStartIcon

Added in 1.9.0-alpha01
@CanIgnoreReturnValue
public @NonNull SectionHeader.Builder setStartIcon(@NonNull CarIcon startIcon)

Sets the start icon of the header with a default size of IMAGE_TYPE_SMALL.

Only custom icon types (e.g. TYPE_CUSTOM) are supported.

Parameters
@NonNull CarIcon startIcon

the CarIcon to display before the title

Throws
java.lang.NullPointerException

if startIcon is null

java.lang.IllegalArgumentException

if startIcon is not a custom icon, or if it does not meet the DEFAULT constraints

setStartIcon

Added in 1.8.0
@CanIgnoreReturnValue
public @NonNull SectionHeader.Builder setStartIcon(@NonNull CarIcon startIcon, int startIconType)

Sets the start icon of the header and its size type.

Only custom icon types (e.g. TYPE_CUSTOM) are supported.

Parameters
@NonNull CarIcon startIcon

the CarIcon to display before the title

int startIconType

the type of image to display. See SectionHeader for supported image types (e.g. IMAGE_TYPE_SMALL).

Throws
java.lang.NullPointerException

if startIcon is null

java.lang.IllegalArgumentException

if startIcon is not a custom icon, or if it does not meet the DEFAULT constraints

setSubtitle

Added in 1.9.0-alpha01
@CanIgnoreReturnValue
public @NonNull SectionHeader.Builder setSubtitle(@NonNull CarText subtitle)

Sets the subtitle of the header.

The subtitle must be a plain string with no spans other than those supported by TEXT_WITH_COLORS.

Parameters
@NonNull CarText subtitle

the subtitle to set

Throws
java.lang.NullPointerException

if subtitle is null

java.lang.IllegalArgumentException

if subtitle contains unsupported spans

See also
CarText

setSubtitle

Added in 1.9.0-alpha01
@CanIgnoreReturnValue
public @NonNull SectionHeader.Builder setSubtitle(@NonNull CharSequence subtitle)

Sets the subtitle of the header.

The subtitle must be a plain string with no spans other than those supported by TEXT_WITH_COLORS.

Parameters
@NonNull CharSequence subtitle

the subtitle to set

Throws
java.lang.NullPointerException

if subtitle is null

java.lang.IllegalArgumentException

if subtitle contains unsupported spans

See also
CarText