HeaderBuilder

open class HeaderBuilder : TemplateSliceBuilder
kotlin.Any
   ↳ androidx.slice.builders.TemplateSliceBuilder
   ↳ androidx.slice.builders.ListBuilder.HeaderBuilder

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 HeaderBuilder#setSummary(CharSequence). This summary might be used when the rest of the list content is not shown (e.g. if SliceView presenting slice is configured to androidx.slice.widget.SliceView#MODE_SMALL.

The primary action specified by HeaderBuilder#setPrimaryAction(SliceAction) will be used as the PendingIntent sent when header is clicked. This action is also used when when SliceView displays in androidx.slice.widget.SliceView#MODE_SHORTCUT.

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

Summary

Public constructors

Create builder for a header.

Public methods
open ListBuilder.HeaderBuilder
setSummarySubtitle(summarySubtitle: CharSequence)

Sets the summary subtitle to be shown in this header.

open ListBuilder.HeaderBuilder
setSummarySubtitle(summarySubtitle: CharSequence, isLoading: Boolean)

Sets the summary subtitle to be shown in this header.

open ListBuilder.HeaderBuilder

Sets the title for the header builder.

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

Sets the title for the header builder.

open ListBuilder.HeaderBuilder

Sets the content description for the header.

open ListBuilder.HeaderBuilder

Sets the action to send when the header is clicked.

open ListBuilder.HeaderBuilder

Sets the summary for the header builder.

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

Sets the summary for the header builder.

open ListBuilder.HeaderBuilder

Sets the subtitle for the header builder.

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

Sets the subtitle for the header builder.

Inherited functions

Public constructors

<init>

HeaderBuilder(parent: ListBuilder)

Create builder for a header.

Public methods

setSummarySubtitle

open fun setSummarySubtitle(summarySubtitle: CharSequence): ListBuilder.HeaderBuilder

Sets the summary subtitle to be shown in this header. If unset, the normal subtitle will be used. The summary is used when the parent template is presented in a small format.

setSummarySubtitle

open fun setSummarySubtitle(summarySubtitle: CharSequence, isLoading: Boolean): ListBuilder.HeaderBuilder

Sets the summary subtitle to be shown in this header. If unset, the normal subtitle will be used. The summary is used when the parent template is presented in a small format.

setTitle

open fun setTitle(title: CharSequence): ListBuilder.HeaderBuilder

Sets the title for the header builder.

setTitle

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

Sets the title for the header builder.

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

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

setContentDescription

open fun setContentDescription(description: CharSequence): ListBuilder.HeaderBuilder

Sets the content description for the header.

setPrimaryAction

open 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 androidx.slice.widget.SliceView#MODE_SHORTCUT.

setSummary

open fun setSummary(summary: CharSequence): ListBuilder.HeaderBuilder

Sets the summary for the header builder. A summary is optional.

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 androidx.slice.widget.SliceView#MODE_SMALL.

setSummary

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

Sets the summary for the header builder. A summary is optional.

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 androidx.slice.widget.SliceView#MODE_SMALL.

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

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

setSubtitle

open fun setSubtitle(subtitle: CharSequence): ListBuilder.HeaderBuilder

Sets the subtitle for the header builder.

setSubtitle

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

Sets the subtitle for the header builder.

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

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