ListBuilder.HeaderBuilder

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

@NonNull ListBuilder.HeaderBuilder

Sets the content description for the header.

@NonNull ListBuilder.HeaderBuilder
setLayoutDirection(int layoutDirection)

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

@NonNull ListBuilder.HeaderBuilder

Sets the action to send when the header is clicked.

@NonNull ListBuilder.HeaderBuilder

Sets the subtitle for the header builder.

@NonNull ListBuilder.HeaderBuilder
setSubtitle(@NonNull CharSequence subtitle, boolean isLoading)

Sets the subtitle for the header builder.

@NonNull ListBuilder.HeaderBuilder

Sets the summary for the header builder.

@NonNull ListBuilder.HeaderBuilder
setSummary(@NonNull CharSequence summary, boolean isLoading)

Sets the summary for the header builder.

@NonNull ListBuilder.HeaderBuilder

Sets the title for the header builder.

@NonNull ListBuilder.HeaderBuilder
setTitle(@NonNull CharSequence title, boolean isLoading)

Sets the title for the header builder.

Public constructors

HeaderBuilder

Added in 1.1.0-alpha02
public HeaderBuilder()

Create builder for a header.

Public methods

setContentDescription

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setContentDescription(@NonNull CharSequence description)

Sets the content description for the header.

setLayoutDirection

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setLayoutDirection(int layoutDirection)

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

Parameters
int layoutDirection

the layout direction to set.

setPrimaryAction

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setPrimaryAction(@NonNull 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 MODE_SHORTCUT.

setSubtitle

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setSubtitle(@NonNull CharSequence subtitle)

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

setSubtitle

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setSubtitle(@NonNull 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
boolean isLoading

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

setSummary

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setSummary(@NonNull 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 MODE_SMALL.

setSummary

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setSummary(@NonNull 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 MODE_SMALL.

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

Parameters
boolean isLoading

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

setTitle

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setTitle(@NonNull 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.

setTitle

Added in 1.1.0-alpha02
public @NonNull ListBuilder.HeaderBuilder setTitle(@NonNull 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
boolean isLoading

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