SectionHeader.Builder


class SectionHeader.Builder


A builder of SectionHeader.

Summary

Public constructors

Builder(title: CarText)

Returns a Builder instance configured with the given title.

Returns a Builder instance configured with the given title.

Public functions

SectionHeader

Builds the SectionHeader.

SectionHeader.Builder

Sets the end icon of the header.

SectionHeader.Builder

Sets the headline of the header.

SectionHeader.Builder

Sets the headline of the header.

SectionHeader.Builder

Sets the click listener for the header.

SectionHeader.Builder

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

SectionHeader.Builder
@CanIgnoreReturnValue
setStartIcon(startIcon: CarIcon, startIconType: Int)

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

SectionHeader.Builder

Sets the subtitle of the header.

SectionHeader.Builder

Sets the subtitle of the header.

Public constructors

Builder

Added in 1.9.0-alpha03
Builder(title: CarText)

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.9.0-alpha03
Builder(title: CharSequence)

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 functions

build

Added in 1.9.0-alpha03
fun build(): SectionHeader

Builds the SectionHeader.

Throws
java.lang.IllegalStateException

if both headline and subtitle are set

setEndIcon

Added in 1.9.0-alpha03
@CanIgnoreReturnValue
fun setEndIcon(endIcon: CarIcon): SectionHeader.Builder

Sets the end icon of the header.

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

Parameters
endIcon: CarIcon

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 UNCONSTRAINED constraints

setHeadline

Added in 1.9.0-alpha03
@CanIgnoreReturnValue
fun setHeadline(headline: CarText?): SectionHeader.Builder

Sets the headline of the header.

The headline appears above the title as an eyebrow or overline. It must be a plain string with no spans other than those supported by TEXT_ONLY.

A section header cannot have both a headline and a subtitle. If both are set, build will throw an IllegalStateException.

Parameters
headline: CarText?

the headline to set

Throws
java.lang.IllegalArgumentException

if headline contains unsupported spans

See also
CarText

setHeadline

Added in 1.9.0-alpha03
@CanIgnoreReturnValue
fun setHeadline(headline: CharSequence): SectionHeader.Builder

Sets the headline of the header.

The headline appears above the title as an eyebrow or overline. It must be a plain string with no spans other than those supported by TEXT_ONLY.

A section header cannot have both a headline and a subtitle. If both are set, build will throw an IllegalStateException.

Parameters
headline: CharSequence

the headline to set

Throws
java.lang.NullPointerException

if headline is null

java.lang.IllegalArgumentException

if headline contains unsupported spans

See also
CarText

setOnClickListener

Added in 1.9.0-alpha03
@CanIgnoreReturnValue
fun setOnClickListener(onClickListener: OnClickListener): SectionHeader.Builder

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-alpha03
@CanIgnoreReturnValue
fun setStartIcon(startIcon: CarIcon): SectionHeader.Builder

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
startIcon: CarIcon

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 UNCONSTRAINED constraints

setStartIcon

Added in 1.9.0-alpha03
@CanIgnoreReturnValue
fun setStartIcon(startIcon: CarIcon, startIconType: Int): SectionHeader.Builder

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

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

Parameters
startIcon: CarIcon

the CarIcon to display before the title

startIconType: Int

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 UNCONSTRAINED constraints

setSubtitle

Added in 1.9.0-alpha03
@CanIgnoreReturnValue
fun setSubtitle(subtitle: CarText?): SectionHeader.Builder

Sets the subtitle of the header.

The subtitle appears below the title. It must be a plain string with no spans other than those supported by TEXT_WITH_COLORS.

A section header cannot have both a headline and a subtitle. If both are set, build will throw an IllegalStateException.

Parameters
subtitle: CarText?

the subtitle to set

Throws
java.lang.IllegalArgumentException

if subtitle contains unsupported spans

See also
CarText

setSubtitle

Added in 1.9.0-alpha03
@CanIgnoreReturnValue
fun setSubtitle(subtitle: CharSequence?): SectionHeader.Builder

Sets the subtitle of the header.

The subtitle appears below the title. It must be a plain string with no spans other than those supported by TEXT_WITH_COLORS.

A section header cannot have both a headline and a subtitle. If both are set, build will throw an IllegalStateException.

Parameters
subtitle: CharSequence?

the subtitle to set

Throws
java.lang.IllegalArgumentException

if subtitle contains unsupported spans

See also
CarText