CellBuilder

class CellBuilder : TemplateSliceBuilder
kotlin.Any
   ↳ androidx.slice.builders.TemplateSliceBuilder
   ↳ androidx.slice.builders.GridBuilder.CellBuilder

Sub-builder to construct a cell to be displayed in a grid.

Content added to a cell will be displayed in order vertically, for example the below code would construct a cell with "First text", and image below it, and then "Second text" below the image.

 CellBuilder cb = new CellBuilder(parent, sliceUri); cb.addText("First text") .addImage(middleIcon) .addText("Second text"); 
A cell can have at most two text items and one image.

Summary

Public constructors

Create a builder which will construct a slice displayed as a cell in a grid.

<init>(parent: GridBuilder, uri: Uri)

Create a builder which will construct a slice displayed as a cell in a grid.

Public methods
GridBuilder.CellBuilder

Adds text to the cell.

GridBuilder.CellBuilder
addTitleText(text: CharSequence?, isLoading: Boolean)

Adds text to the cell.

GridBuilder.CellBuilder

GridBuilder.CellBuilder
addLargeImage(image: Icon?, isLoading: Boolean)

GridBuilder.CellBuilder
addImage(image: Icon)

GridBuilder.CellBuilder
addImage(image: Icon?, isLoading: Boolean)

GridBuilder.CellBuilder
addImage(image: Icon, imageMode: Int)

GridBuilder.CellBuilder
addImage(image: Icon?, imageMode: Int, isLoading: Boolean)

GridBuilder.CellBuilder
addImage(image: IconCompat, imageMode: Int)

Adds an image to the cell.

GridBuilder.CellBuilder
addImage(image: IconCompat?, imageMode: Int, isLoading: Boolean)

Adds an image to the cell.

GridBuilder.CellBuilder

Adds text to the cell.

GridBuilder.CellBuilder
addText(text: CharSequence?, isLoading: Boolean)

Adds text to the cell.

GridBuilder.CellBuilder

Sets the content description for this cell.

GridBuilder.CellBuilder

Sets the action to be invoked if the user taps on this cell in the row.

Inherited functions

Public constructors

<init>

CellBuilder(parent: GridBuilder)

Create a builder which will construct a slice displayed as a cell in a grid.

Parameters
parent GridBuilder: The builder constructing the parent slice.

<init>

CellBuilder(parent: GridBuilder, uri: Uri)

Create a builder which will construct a slice displayed as a cell in a grid.

Parameters
uri GridBuilder: Uri to tag for this slice.

Public methods

addTitleText

fun addTitleText(text: CharSequence): GridBuilder.CellBuilder

Adds text to the cell. Text added with this method will be styled as a title. There can be at most two text items, the first two added will be used, others will be ignored.

addTitleText

fun addTitleText(text: CharSequence?, isLoading: Boolean): GridBuilder.CellBuilder

Adds text to the cell. Text added with this method will be styled as a title. There can be at most two text items, the first two added will be used, others will be ignored.

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

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

addLargeImage

fun 
        addLargeImage
(image: Icon): GridBuilder.CellBuilder

Deprecated:

Adds an image to the cell that should be displayed as large as the cell allows. There can be at most one image, the first one added will be used, others will be ignored.

Parameters
image Icon: the image to display in the cell.

addLargeImage

fun 
        addLargeImage
(image: Icon?, isLoading: Boolean): GridBuilder.CellBuilder

Deprecated:

Adds an image to the cell that should be displayed as large as the cell allows. There can be at most one image, the first one added will be used, others will be ignored.

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

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

addImage

fun 
        addImage
(image: Icon): GridBuilder.CellBuilder

Deprecated:

Adds an image to the cell. There can be at most one image, the first one added will be used, others will be ignored.

Parameters
image Icon: the image to display in the cell.

addImage

fun addImage(image: Icon?, isLoading: Boolean): GridBuilder.CellBuilder

addImage

fun addImage(image: Icon, imageMode: Int): GridBuilder.CellBuilder

addImage

fun addImage(image: Icon?, imageMode: Int, isLoading: Boolean): GridBuilder.CellBuilder

addImage

fun addImage(image: IconCompat, imageMode: Int): GridBuilder.CellBuilder

Adds an image to the cell. There can be at most one image, the first one added will be used, others will be ignored.

Parameters
image IconCompat: the image to display in the cell.
imageMode IconCompat: the mode that image should be displayed in.

addImage

fun addImage(image: IconCompat?, imageMode: Int, isLoading: Boolean): GridBuilder.CellBuilder

Adds an image to the cell. There can be at most one image, the first one added will be used, others will be ignored.

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

Parameters
image IconCompat?: the image to display in the cell.
imageMode IconCompat?: the mode that image should be displayed in.
isLoading IconCompat?: indicates whether the app is doing work to load the added content in the background or not.

addText

fun addText(text: CharSequence): GridBuilder.CellBuilder

Adds text to the cell. There can be at most two text items, the first two added will be used, others will be ignored.

addText

fun addText(text: CharSequence?, isLoading: Boolean): GridBuilder.CellBuilder

Adds text to the cell. There can be at most two text items, the first two added will be used, others will be ignored.

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

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

setContentDescription

fun setContentDescription(description: CharSequence): GridBuilder.CellBuilder

Sets the content description for this cell.

setContentIntent

fun setContentIntent(intent: PendingIntent): GridBuilder.CellBuilder

Sets the action to be invoked if the user taps on this cell in the row.