public class

ListBuilder.HeaderBuilder

extends java.lang.Object

 java.lang.Object

↳androidx.slice.builders.ListBuilder.HeaderBuilder

Overview

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

The primary action specified by ListBuilder.HeaderBuilder.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

Constructors
publicHeaderBuilder()

Create builder for a header.

publicHeaderBuilder(Uri uri)

Methods
public java.lang.CharSequencegetContentDescription()

public intgetLayoutDirection()

public SliceActiongetPrimaryAction()

public java.lang.CharSequencegetSubtitle()

public java.lang.CharSequencegetSummary()

public java.lang.CharSequencegetTitle()

public UrigetUri()

public booleanisSubtitleLoading()

public booleanisSummaryLoading()

public booleanisTitleLoading()

public ListBuilder.HeaderBuildersetContentDescription(java.lang.CharSequence description)

Sets the content description for the header.

public ListBuilder.HeaderBuildersetLayoutDirection(int layoutDirection)

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

public ListBuilder.HeaderBuildersetPrimaryAction(SliceAction action)

Sets the action to send when the header is clicked.

public ListBuilder.HeaderBuildersetSubtitle(java.lang.CharSequence subtitle)

Sets the subtitle for the header builder.

public ListBuilder.HeaderBuildersetSubtitle(java.lang.CharSequence subtitle, boolean isLoading)

Sets the subtitle for the header builder.

public ListBuilder.HeaderBuildersetSummary(java.lang.CharSequence summary)

Sets the summary for the header builder.

public ListBuilder.HeaderBuildersetSummary(java.lang.CharSequence summary, boolean isLoading)

Sets the summary for the header builder.

public ListBuilder.HeaderBuildersetTitle(java.lang.CharSequence title)

Sets the title for the header builder.

public ListBuilder.HeaderBuildersetTitle(java.lang.CharSequence title, boolean isLoading)

Sets the title for the header builder.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructors

public HeaderBuilder()

Create builder for a header.

public HeaderBuilder(Uri uri)

Methods

public ListBuilder.HeaderBuilder setTitle(java.lang.CharSequence title)

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

public ListBuilder.HeaderBuilder setTitle(java.lang.CharSequence title, boolean isLoading)

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: indicates whether the app is doing work to load the added content in the background or not.

public ListBuilder.HeaderBuilder setSubtitle(java.lang.CharSequence subtitle)

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

public ListBuilder.HeaderBuilder setSubtitle(java.lang.CharSequence subtitle, boolean isLoading)

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: indicates whether the app is doing work to load the added content in the background or not.

public ListBuilder.HeaderBuilder setSummary(java.lang.CharSequence summary)

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

public ListBuilder.HeaderBuilder setSummary(java.lang.CharSequence summary, boolean isLoading)

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

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

Parameters:

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

public 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.

public ListBuilder.HeaderBuilder setContentDescription(java.lang.CharSequence description)

Sets the content description for the header.

public ListBuilder.HeaderBuilder setLayoutDirection(int layoutDirection)

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

Parameters:

layoutDirection: the layout direction to set.

public Uri getUri()

public java.lang.CharSequence getTitle()

public boolean isTitleLoading()

public java.lang.CharSequence getSubtitle()

public boolean isSubtitleLoading()

public java.lang.CharSequence getSummary()

public boolean isSummaryLoading()

public SliceAction getPrimaryAction()

public java.lang.CharSequence getContentDescription()

public int getLayoutDirection()