ListBuilder.HeaderBuilder

class ListBuilder.HeaderBuilder

Known direct subclasses
HeaderBuilderDsl

Helper class annotated with @SliceMarker, which is annotated with @DslMarker.


Builder to construct a header row.

A header provides some additional functionality compared to a RowBuilder. Like a row, a header has a title, subtitle, and primary action.

In addition to a row's title, subtitle, and primary action, a header also supports setting a summary description of the list contents using setSummary. This summary might be used when the rest of the list content is not shown (e.g. if SliceView presenting slice is configured to MODE_SMALL.

The primary action specified by setPrimaryAction will be used as the PendingIntent sent when header is clicked. This action is also used when when SliceView displays in MODE_SHORTCUT.

Unlike row builder, header builder does not support end items (e.g. addEndItem). The header may be used to display actions set on the list via addAction.

Summary

Public constructors

Create builder for a header.

Public functions

ListBuilder.HeaderBuilder

Sets the content description for the header.

ListBuilder.HeaderBuilder
setLayoutDirection(layoutDirection: Int)

Sets the desired layout direction for the content in this row.

ListBuilder.HeaderBuilder

Sets the action to send when the header is clicked.

ListBuilder.HeaderBuilder

Sets the subtitle for the header builder.

ListBuilder.HeaderBuilder
setSubtitle(subtitle: CharSequence, isLoading: Boolean)

Sets the subtitle for the header builder.

ListBuilder.HeaderBuilder

Sets the summary for the header builder.

ListBuilder.HeaderBuilder
setSummary(summary: CharSequence, isLoading: Boolean)

Sets the summary for the header builder.

ListBuilder.HeaderBuilder

Sets the title for the header builder.

ListBuilder.HeaderBuilder
setTitle(title: CharSequence, isLoading: Boolean)

Sets the title for the header builder.

Public constructors

HeaderBuilder

Added in 1.1.0-alpha02
HeaderBuilder()

Create builder for a header.

Public functions

setContentDescription

Added in 1.1.0-alpha02
fun setContentDescription(description: CharSequence): ListBuilder.HeaderBuilder

Sets the content description for the header.

setLayoutDirection

Added in 1.1.0-alpha02
fun setLayoutDirection(layoutDirection: Int): ListBuilder.HeaderBuilder

Sets the desired layout direction for the content in this row.

Parameters
layoutDirection: Int

the layout direction to set.

setPrimaryAction

Added in 1.1.0-alpha02
fun setPrimaryAction(action: SliceAction): ListBuilder.HeaderBuilder

Sets the action to send when the header is clicked.

Additionally, the action specified here is used when the slice associated with this header is displayed in MODE_SHORTCUT.

setSubtitle

Added in 1.1.0-alpha02
fun setSubtitle(subtitle: CharSequence): ListBuilder.HeaderBuilder

Sets the subtitle for the header builder. The subtitle should fit on a single line.

setSubtitle

Added in 1.1.0-alpha02
fun setSubtitle(subtitle: CharSequence, isLoading: Boolean): ListBuilder.HeaderBuilder

Sets the subtitle for the header builder. The subtitle should fit on a single line.

Use this method to specify content that will appear in the template once it's been loaded.

Parameters
isLoading: Boolean

indicates whether the app is doing work to load the added content in the background or not.

setSummary

Added in 1.1.0-alpha02
fun setSummary(summary: CharSequence): ListBuilder.HeaderBuilder

Sets the summary for the header builder. A summary is optional and should fit on a single line and is ellipsized if too long.

The summary should be a description of the contents of the list. This summary might be used when the rest of the list content is not shown (e.g. if SliceView presenting slice is configured to MODE_SMALL.

setSummary

Added in 1.1.0-alpha02
fun setSummary(summary: CharSequence, isLoading: Boolean): ListBuilder.HeaderBuilder

Sets the summary for the header builder. A summary is optional and should fit on a single line and is ellipsized if too long.

The summary should be a description of the contents of the list. This summary might be used when the rest of the list content is not shown (e.g. if SliceView presenting slice is configured to MODE_SMALL.

Use this method to specify content that will appear in the template once it's been loaded.

Parameters
isLoading: Boolean

indicates whether the app is doing work to load the added content in the background or not.

setTitle

Added in 1.1.0-alpha02
fun setTitle(title: CharSequence): ListBuilder.HeaderBuilder

Sets the title for the header builder. A title should be representative of the contents of the slice and fit on a single line.

setTitle

Added in 1.1.0-alpha02
fun setTitle(title: CharSequence, isLoading: Boolean): ListBuilder.HeaderBuilder

Sets the title for the header builder. A title should be representative of the contents of the slice and fit on a single line.

Use this method to specify content that will appear in the template once it's been loaded.

Parameters
isLoading: Boolean

indicates whether the app is doing work to load the added content in the background or not.