ListBuilder.HeaderBuilder
public
static
class
ListBuilder.HeaderBuilder
extends Object
java.lang.Object | |
↳ | 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 | |
---|---|
HeaderBuilder()
Create builder for a header. |
Public methods | |
---|---|
ListBuilder.HeaderBuilder
|
setContentDescription(CharSequence description)
Sets the content description for the header. |
ListBuilder.HeaderBuilder
|
setLayoutDirection(int layoutDirection)
Sets the desired layout direction for the content in this row. |
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
|
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
HeaderBuilder
public HeaderBuilder ()
Create builder for a header.
Public methods
setContentDescription
public ListBuilder.HeaderBuilder setContentDescription (CharSequence description)
Sets the content description for the header.
Parameters | |
---|---|
description |
CharSequence |
Returns | |
---|---|
ListBuilder.HeaderBuilder |
setLayoutDirection
public ListBuilder.HeaderBuilder setLayoutDirection (int layoutDirection)
Sets the desired layout direction for the content in this row.
Parameters | |
---|---|
layoutDirection |
int : the layout direction to set.
|
Returns | |
---|---|
ListBuilder.HeaderBuilder |
setPrimaryAction
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
.
Parameters | |
---|---|
action |
SliceAction |
Returns | |
---|---|
ListBuilder.HeaderBuilder |
setSubtitle
public ListBuilder.HeaderBuilder setSubtitle (CharSequence subtitle)
Sets the subtitle for the header builder. The subtitle should fit on a single line.
Parameters | |
---|---|
subtitle |
CharSequence |
Returns | |
---|---|
ListBuilder.HeaderBuilder |
setSubtitle
public ListBuilder.HeaderBuilder setSubtitle (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 | |
---|---|
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
public ListBuilder.HeaderBuilder setSummary (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
.
Parameters | |
---|---|
summary |
CharSequence |
Returns | |
---|---|
ListBuilder.HeaderBuilder |
setSummary
public ListBuilder.HeaderBuilder setSummary (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 | |
---|---|
summary |
CharSequence |
isLoading |
boolean : indicates whether the app is doing work to load the added content in the
background or not.
|
Returns | |
---|---|
ListBuilder.HeaderBuilder |
setTitle
public ListBuilder.HeaderBuilder setTitle (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.
Parameters | |
---|---|
title |
CharSequence |
Returns | |
---|---|
ListBuilder.HeaderBuilder |
setTitle
public ListBuilder.HeaderBuilder setTitle (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 | |
---|---|
title |
CharSequence |
isLoading |
boolean : indicates whether the app is doing work to load the added content in the
background or not.
|
Returns | |
---|---|
ListBuilder.HeaderBuilder |