ListBuilder |
addAction(@NonNull action: SliceAction)
Adds an action to this list builder.
Actions added with this method are grouped together on the list template and represented as tappable icons or images. These actions may appear differently on the slice depending on how the androidx.slice.widget.SliceView is configured. Generally these actions will be displayed in the order they were added, however, if not all actions can be displayed then actions with a higher priority may be shown first.
These actions are only displayed when the slice is displayed in androidx.slice.widget.SliceView#MODE_LARGE or androidx.slice.widget.SliceView#MODE_SMALL .
These actions differ from a slice's primary action. The primary action is the SliceAction set on the first row of the slice, normally from HeaderBuilder#setPrimaryAction(SliceAction) .
|
ListBuilder |
addGridRow(@NonNull builder: GridRowBuilder)
Add a grid row to the list builder.
Note that grid rows cannot be the first row in your slice. Adding a grid row first without calling setHeader(HeaderBuilder) will result in IllegalStateException when the slice is built.
|
ListBuilder |
addInputRange(@NonNull b: ListBuilder.InputRangeBuilder)
Add an input range row to the list builder.
If InputRangeBuilder#setValue(int) is not between InputRangeBuilder#setMin(int) and InputRangeBuilder#setMax(int) , this will throw IllegalArgumentException .
|
ListBuilder |
addRange(@NonNull rangeBuilder: ListBuilder.RangeBuilder)
Add a range row to the list builder.
If RangeBuilder#setValue(int) is not between 0 and RangeBuilder#setMax(int) , this will throw IllegalArgumentException .
|
ListBuilder |
addRating(@NonNull b: ListBuilder.RatingBuilder)
Add an star rating row to the list builder.
If RatingBuilder#setValue(float) is not between RatingBuilder#setMin(int) and RatingBuilder#setMax(int) , this will show all stars as unselected.
|
ListBuilder |
addRow(@NonNull builder: ListBuilder.RowBuilder)
Add a row to the list builder.
|
ListBuilder |
addSelection(@NonNull selectionBuilder: SelectionBuilder)
Add a selection row to the list builder.
|
Slice |
build()
Construct the slice defined by this ListBuilder.
Note that a ListBuilder requires a row containing a piece of text that is not created from a GridRowBuilder . If the first row added does not fulfill this requirement, build the slice will throw IllegalStateException .
Note that a ListBuilder requires a primary action, this can be set on any of the rows added to the list. If a primary action has not been set on any of the rows, building this slice will throw IllegalStateException .
|
ListBuilder |
setAccentColor(@ColorInt color: Int)
Sets the color to use on tintable items within the list builder. Things that might be tinted are:
|
ListBuilder |
setHeader(@NonNull builder: ListBuilder.HeaderBuilder)
Sets a header for this list builder. A list can have only one header. Setting a header allows some flexibility in what's displayed in your slice when SliceView displays in androidx.slice.widget.SliceView#MODE_SMALL and androidx.slice.widget.SliceView#MODE_SHORTCUT .
In MODE_SMALL, the header row shown if one has been added. The header will also display the HeaderBuilder#setSummary(CharSequence) text if it has been specified, allowing a summary of otherwise hidden content to be shown.
In MODE_SHORTCUT, the primary action set using HeaderBuilder#setPrimaryAction(SliceAction) will be used for the shortcut representation.
|
ListBuilder |
setHostExtras(@NonNull extras: PersistableBundle)
Sets additional information to be passed to the host of the slice.
|
ListBuilder |
setIsError(isError: Boolean)
Sets whether this slice indicates an error, i.e. the normal contents of this slice are unavailable and instead the slice contains a message indicating an error.
|
ListBuilder |
setKeywords(@NonNull keywords: MutableSet<String!>)
Sets keywords to associate with this slice.
|
ListBuilder |
setLayoutDirection(layoutDirection: Int)
Sets the desired layout direction for this slice.
|
ListBuilder |
setSeeMoreAction(@NonNull intent: PendingIntent)
If all content in a slice cannot be shown, a "see more" affordance may be displayed where the content is cut off. The action added here should take the user to an activity to see all of the content, and will be invoked when the "see more" affordance is tapped.
Only one see more affordance can be added, this throws IllegalStateException if a row or action has been previously added.
|
ListBuilder |
setSeeMoreAction(@NonNull callback: RemoteCallback)
If all content in a slice cannot be shown, a "see more" affordance may be displayed where the content is cut off. The action added here should take the user to an activity to see all of the content, and will be invoked when the "see more" affordance is tapped.
Only one see more affordance can be added, this throws IllegalStateException if a row or action has been previously added.
|
ListBuilder |
setSeeMoreRow(@NonNull builder: ListBuilder.RowBuilder)
If all content in a slice cannot be shown, the row added here may be displayed where the content is cut off. This row should have an affordance to take the user to an activity to see all of the content.
This method should only be used if you want to display a customized row to indicate more content, consider using setSeeMoreAction(PendingIntent) otherwise. If you do choose to specify a custom row, the row should have a content intent or action end item specified to take the user to an activity to see all of the content. The row added here will only appear when not all content can be displayed and it will not be styled any differently from row built by RowBuilder normally.
Only one see more affordance can be added, this throws IllegalStateException if a row or action has been previously added.
|