Tab.Builder

class Tab.Builder


A builder of Tab.

Summary

Public constructors

Returns an empty Tab.Builder instance.

Builder(tab: Tab)

Creates a new Builder, populated from the input Tab

Public functions

Tab

Constructs the Tab defined by this builder.

Tab.Builder
setContentId(contentId: String)

Sets the content ID of the tab.

Tab.Builder

Sets the icon to display in the tab.

Tab.Builder

Sets the title of the tab.

Public constructors

Builder

Added in 1.3.0
Builder()

Returns an empty Tab.Builder instance.

Builder

Added in 1.4.0-rc02
Builder(tab: Tab)

Creates a new Builder, populated from the input Tab

Public functions

build

Added in 1.3.0
fun build(): Tab

Constructs the Tab defined by this builder.

Throws
java.lang.IllegalStateException

if the tab's title, icon or content ID is not set.

setContentId

Added in 1.3.0
fun setContentId(contentId: String): Tab.Builder

Sets the content ID of the tab.

Throws
java.lang.NullPointerException

if contentId is null

java.lang.IllegalArgumentException

if contentId is empty

setIcon

Added in 1.3.0
fun setIcon(icon: CarIcon): Tab.Builder

Sets the icon to display in the tab.

Icon Sizing Guidance To minimize scaling artifacts across a wide range of car screens, apps should provide icons targeting a 36 x 36 dp bounding box. If the icon exceeds this maximum size in either one of the dimensions, it will be scaled down to be centered inside the bounding box while preserving its aspect ratio.

See CarIcon for more details related to providing icon and image resources that work with different car screen pixel densities.

Throws
java.lang.NullPointerException

if icon is null

setTitle

Added in 1.3.0
fun setTitle(title: CharSequence): Tab.Builder

Sets the title of the tab.

Only DistanceSpans and DurationSpans are supported in the input string.

Throws
java.lang.NullPointerException

if title is null

java.lang.IllegalArgumentException

if title is empty, of if it contains unsupported spans