public class

ListBuilder.RowBuilder

extends java.lang.Object

 java.lang.Object

↳androidx.slice.builders.ListBuilder.RowBuilder

Overview

Builder to construct a row. A row can be added as an item to ListBuilder via ListBuilder.addRow(ListBuilder.RowBuilder).

A row supports:

  • Title item - The title item can be a timestamp, image, or a SliceAction. It appears with at the start of the row. There can only be one title item added to a row.
  • Title - Single line of text formatted as a title, see ListBuilder.RowBuilder.setTitle(CharSequence).
  • Subtitle - Single line of text below the title (if one exists) and is formatted as normal text, see ListBuilder.RowBuilder.setSubtitle(CharSequence).
  • End item - End items appear at the end of the row. There can be multiple end items that show depending on available width. End items can be a timestamp, image, or a tappable icon.
  • Primary action - The primary action for the row, this is the action that will be sent when the row is clicked. This is set via ListBuilder.RowBuilder.setPrimaryAction(SliceAction). If this is the only row or first row of the slice, then the action set here will be used to represent the slice shown in SliceView.MODE_SMALL.
There are a couple of restrictions to how content can be added to a row:
  • End items cannot contain a mixture of SliceActions and Icons.
  • There can only be one timestamp added to the row.

Summary

Fields
public static final intTYPE_ACTION

public static final intTYPE_ICON

public static final intTYPE_TIMESTAMP

Constructors
publicRowBuilder()

Builder to construct a row.

publicRowBuilder(Uri uri)

Builder to construct a normal row.

Methods
public ListBuilder.RowBuilderaddEndItem(IconCompat icon, int imageMode)

Adds an icon to the end items of the row builder.

public ListBuilder.RowBuilderaddEndItem(IconCompat icon, int imageMode, boolean isLoading)

Adds an icon to the end items of the row builder.

public ListBuilder.RowBuilderaddEndItem(long timeStamp)

Adds a timestamp to the end items of the row builder.

public ListBuilder.RowBuilderaddEndItem(SliceAction action)

Adds an action to the end items of the row builder.

public ListBuilder.RowBuilderaddEndItem(SliceAction action, boolean isLoading)

Adds an action to the end items of the row builder.

public java.lang.CharSequencegetContentDescription()

public java.util.List<java.lang.Object>getEndItems()

public java.util.List<java.lang.Boolean>getEndLoads()

public java.util.List<java.lang.Integer>getEndTypes()

public intgetLayoutDirection()

public SliceActiongetPrimaryAction()

public java.lang.CharSequencegetSubtitle()

public longgetTimeStamp()

public java.lang.CharSequencegetTitle()

public SliceActiongetTitleAction()

public IconCompatgetTitleIcon()

public intgetTitleImageMode()

public UrigetUri()

public booleanhasDefaultToggle()

public booleanhasEndActionOrToggle()

public booleanhasEndImage()

public booleanhasTimestamp()

public booleanisEndOfSection()

public booleanisSubtitleLoading()

public booleanisTitleActionLoading()

public booleanisTitleItemLoading()

public booleanisTitleLoading()

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

Sets the content description for the row.

public ListBuilder.RowBuildersetEndOfSection(boolean isEndOfSection)

Indicate that this row is an end for a section.

public ListBuilder.RowBuildersetLayoutDirection(int layoutDirection)

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

public ListBuilder.RowBuildersetPrimaryAction(SliceAction action)

The action specified here will be sent when the whole row is clicked.

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

Sets the subtitle for the row builder.

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

Sets the subtitle for the row builder.

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

Sets the title for the row builder.

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

Sets the title for the row builder.

public ListBuilder.RowBuildersetTitleItem(IconCompat icon, int imageMode)

Sets the title item to be the provided icon.

public ListBuilder.RowBuildersetTitleItem(IconCompat icon, int imageMode, boolean isLoading)

Sets the title item to be the provided icon.

public ListBuilder.RowBuildersetTitleItem(long timeStamp)

Sets the title item to be the provided timestamp.

public ListBuilder.RowBuildersetTitleItem(SliceAction action)

Sets the title item to be a tappable icon.

public ListBuilder.RowBuildersetTitleItem(SliceAction action, boolean isLoading)

Sets the title item to be a tappable icon.

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

Fields

public static final int TYPE_TIMESTAMP

public static final int TYPE_ICON

public static final int TYPE_ACTION

Constructors

public RowBuilder()

Builder to construct a row.

public RowBuilder(Uri uri)

Builder to construct a normal row.

Parameters:

uri: Uri to tag for this slice.

Methods

public ListBuilder.RowBuilder setEndOfSection(boolean isEndOfSection)

Indicate that this row is an end for a section.

public ListBuilder.RowBuilder setTitleItem(long timeStamp)

Sets the title item to be the provided timestamp. Only one timestamp can be added, if one is already added this will throw java.lang.IllegalArgumentException.

There can only be one title item, this will replace any other title items that may have been set.

public ListBuilder.RowBuilder setTitleItem(IconCompat icon, int imageMode)

Sets the title item to be the provided icon. There can only be one title item, this will replace any other title items that may have been set.

Parameters:

icon: the image to display.
imageMode: the mode that image should be displayed in.

See also: ListBuilder.ICON_IMAGE, ListBuilder.SMALL_IMAGE, ListBuilder.LARGE_IMAGE

public ListBuilder.RowBuilder setTitleItem(IconCompat icon, int imageMode, boolean isLoading)

Sets the title item to be the provided icon. There can only be one title item, this will replace any other title items that may have been set.

When set to true, the parameter isLoading indicates that the app is doing work to load this content in the background, in this case the template displays a placeholder until updated.

Parameters:

icon: the image to display.
imageMode: the mode that image should be displayed in.
isLoading: whether this content is being loaded in the background.

See also: ListBuilder.ICON_IMAGE, ListBuilder.SMALL_IMAGE, ListBuilder.LARGE_IMAGE

public ListBuilder.RowBuilder setTitleItem(SliceAction action)

Sets the title item to be a tappable icon. There can only be one title item, this will replace any other title items that may have been set.

public ListBuilder.RowBuilder setTitleItem(SliceAction action, boolean isLoading)

Sets the title item to be a tappable icon. There can only be one title item, this will replace any other title items that may have been set.

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.RowBuilder setPrimaryAction(SliceAction action)

The action specified here will be sent when the whole row is clicked.

If this is the first row in a ListBuilder this action will also be used to define the SliceView.MODE_SHORTCUT representation of the slice.

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

Sets the title for the row builder. A title should fit on a single line and is ellipsized if too long.

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

Sets the title for the row builder. A title should fit on a single line and is ellipsized if too long.

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.RowBuilder setSubtitle(java.lang.CharSequence subtitle)

Sets the subtitle for the row builder. A subtitle should fit on a single line and is ellipsized if too long.

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

Sets the subtitle for the row builder. A subtitle should fit on a single line and is ellipsized if too long.

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.RowBuilder addEndItem(long timeStamp)

Adds a timestamp to the end items of the row builder. Only one timestamp can be added, if one is already added this will throw java.lang.IllegalArgumentException.

public ListBuilder.RowBuilder addEndItem(IconCompat icon, int imageMode)

Adds an icon to the end items of the row builder.

Parameters:

icon: the image to display.
imageMode: the mode that image should be displayed in.

See also: ListBuilder.ICON_IMAGE, ListBuilder.SMALL_IMAGE, ListBuilder.LARGE_IMAGE

public ListBuilder.RowBuilder addEndItem(IconCompat icon, int imageMode, boolean isLoading)

Adds an icon to the end items of the row builder.

When set to true, the parameter isLoading indicates that the app is doing work to load this content in the background, in this case the template displays a placeholder until updated.

Parameters:

icon: the image to display.
imageMode: the mode that image should be displayed in.
isLoading: whether this content is being loaded in the background.

See also: ListBuilder.ICON_IMAGE, ListBuilder.SMALL_IMAGE, ListBuilder.LARGE_IMAGE

public ListBuilder.RowBuilder addEndItem(SliceAction action)

Adds an action to the end items of the row builder. A mixture of icons and actions is not permitted. If an icon has already been added, this will throw java.lang.IllegalArgumentException.

public ListBuilder.RowBuilder addEndItem(SliceAction action, boolean isLoading)

Adds an action to the end items of the row builder. A mixture of icons and actions is not permitted. If an icon has already been added, this will throw java.lang.IllegalArgumentException.

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.RowBuilder setContentDescription(java.lang.CharSequence description)

Sets the content description for the row.

public ListBuilder.RowBuilder 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 boolean isEndOfSection()

public boolean hasEndActionOrToggle()

public boolean hasEndImage()

public boolean hasDefaultToggle()

public boolean hasTimestamp()

public long getTimeStamp()

public boolean isTitleItemLoading()

public int getTitleImageMode()

public IconCompat getTitleIcon()

public SliceAction getTitleAction()

public SliceAction getPrimaryAction()

public java.lang.CharSequence getTitle()

public boolean isTitleLoading()

public java.lang.CharSequence getSubtitle()

public boolean isSubtitleLoading()

public java.lang.CharSequence getContentDescription()

public int getLayoutDirection()

public java.util.List<java.lang.Object> getEndItems()

public java.util.List<java.lang.Integer> getEndTypes()

public java.util.List<java.lang.Boolean> getEndLoads()

public boolean isTitleActionLoading()