belongs to Maven artifact androidx.slice:slice-builders:1.0.0-alpha1

ListBuilder.HeaderBuilder

public static class ListBuilder.HeaderBuilder
extends TemplateSliceBuilder

java.lang.Object
   ↳ androidx.slice.builders.TemplateSliceBuilder
     ↳ androidx.slice.builders.ListBuilder.HeaderBuilder


Builder to construct a header row.

A header provides some additional functionality compared to a ListBuilder.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(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 SliceView.MODE_SMALL.

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

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

Summary

Public constructors

ListBuilder.HeaderBuilder(ListBuilder parent)

Create builder for a header.

Public methods

ListBuilder.HeaderBuilder setContentDescription(CharSequence description)

Sets the content description for the header.

ListBuilder.HeaderBuilder setPrimaryAction(SliceAction action)

Sets the action to send when the header is clicked.

ListBuilder.HeaderBuilder setSubtitle(CharSequence subtitle)

Sets the subtitle for the header builder.

ListBuilder.HeaderBuilder setSubtitle(CharSequence subtitle, boolean isLoading)

Sets the subtitle for the header builder.

ListBuilder.HeaderBuilder setSummary(CharSequence summary)

Sets the summary for the header builder.

ListBuilder.HeaderBuilder setSummary(CharSequence summary, boolean isLoading)

Sets the summary for the header builder.

ListBuilder.HeaderBuilder setSummarySubtitle(CharSequence summarySubtitle)

This method is deprecated. TO BE REMOVED; use setSummary(CharSequence)

ListBuilder.HeaderBuilder setSummarySubtitle(CharSequence summarySubtitle, boolean isLoading)

This method is deprecated. TO BE REMOVED; use setSummary(CharSequence, boolean)

ListBuilder.HeaderBuilder setTitle(CharSequence title)

Sets the title for the header builder.

ListBuilder.HeaderBuilder setTitle(CharSequence title, boolean isLoading)

Sets the title for the header builder.

Inherited methods

Public constructors

ListBuilder.HeaderBuilder

ListBuilder.HeaderBuilder (ListBuilder parent)

Create builder for a header.

Parameters
parent ListBuilder

Public methods

setContentDescription

ListBuilder.HeaderBuilder setContentDescription (CharSequence description)

Sets the content description for the header.

Parameters
description CharSequence

Returns
ListBuilder.HeaderBuilder

setPrimaryAction

ListBuilder.HeaderBuilder setPrimaryAction (SliceAction action)

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 SliceView.MODE_SHORTCUT.

Parameters
action SliceAction

Returns
ListBuilder.HeaderBuilder

setSubtitle

ListBuilder.HeaderBuilder setSubtitle (CharSequence subtitle)

Sets the subtitle for the header builder.

Parameters
subtitle CharSequence

Returns
ListBuilder.HeaderBuilder

setSubtitle

ListBuilder.HeaderBuilder setSubtitle (CharSequence subtitle, 
                boolean isLoading)

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
subtitle CharSequence

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

Returns
ListBuilder.HeaderBuilder

setSummary

ListBuilder.HeaderBuilder setSummary (CharSequence summary)

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 SliceView.MODE_SMALL.

Parameters
summary CharSequence

Returns
ListBuilder.HeaderBuilder

setSummary

ListBuilder.HeaderBuilder setSummary (CharSequence summary, 
                boolean isLoading)

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 SliceView.MODE_SMALL.

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

Parameters
summary CharSequence

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

Returns
ListBuilder.HeaderBuilder

setSummarySubtitle

ListBuilder.HeaderBuilder setSummarySubtitle (CharSequence summarySubtitle)

This method is deprecated.
TO BE REMOVED; use setSummary(CharSequence)

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.

Parameters
summarySubtitle CharSequence

Returns
ListBuilder.HeaderBuilder

setSummarySubtitle

ListBuilder.HeaderBuilder setSummarySubtitle (CharSequence summarySubtitle, 
                boolean isLoading)

This method is deprecated.
TO BE REMOVED; use setSummary(CharSequence, boolean)

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.

Parameters
summarySubtitle CharSequence

isLoading boolean

Returns
ListBuilder.HeaderBuilder

setTitle

ListBuilder.HeaderBuilder setTitle (CharSequence title)

Sets the title for the header builder.

Parameters
title CharSequence

Returns
ListBuilder.HeaderBuilder

setTitle

ListBuilder.HeaderBuilder setTitle (CharSequence title, 
                boolean isLoading)

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
title CharSequence

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

Returns
ListBuilder.HeaderBuilder