lightbulb_outline Help shape the future of the Google Play Console, Android Studio, and Firebase. Start survey

belongs to Maven artifact androidx.slice:slice-builders:1.0.0-alpha3

GridBuilder.CellBuilder

public static final class GridBuilder.CellBuilder
extends TemplateSliceBuilder

java.lang.Object
   ↳ androidx.slice.builders.TemplateSliceBuilder
     ↳ androidx.slice.builders.GridBuilder.CellBuilder


This class is deprecated.
TO BE REMOVED; please use GridRowBuilder.CellBuilder instead.

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

GridBuilder.CellBuilder(GridBuilder parent)

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

GridBuilder.CellBuilder(GridBuilder parent, Uri uri)

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

Public methods

GridBuilder.CellBuilder addImage(Icon image, boolean isLoading)

This method is deprecated. TO BE REMOVED

GridBuilder.CellBuilder addImage(IconCompat image, int imageMode)

Adds an image to the cell.

GridBuilder.CellBuilder addImage(Icon image, int imageMode, boolean isLoading)

This method is deprecated. TO BE REMOVED

GridBuilder.CellBuilder addImage(IconCompat image, int imageMode, boolean isLoading)

Adds an image to the cell.

GridBuilder.CellBuilder addImage(Icon image)

Adds an image to the cell.

GridBuilder.CellBuilder addImage(Icon image, int imageMode)

This method is deprecated. TO BE REMOVED

GridBuilder.CellBuilder addLargeImage(Icon image, boolean isLoading)

Adds an image to the cell that should be displayed as large as the cell allows.

GridBuilder.CellBuilder addLargeImage(Icon image)

Adds an image to the cell that should be displayed as large as the cell allows.

GridBuilder.CellBuilder addText(CharSequence text)

Adds text to the cell.

GridBuilder.CellBuilder addText(CharSequence text, boolean isLoading)

Adds text to the cell.

GridBuilder.CellBuilder addTitleText(CharSequence text, boolean isLoading)

Adds text to the cell.

GridBuilder.CellBuilder addTitleText(CharSequence text)

Adds text to the cell.

GridBuilder.CellBuilder setContentDescription(CharSequence description)

Sets the content description for this cell.

GridBuilder.CellBuilder setContentIntent(PendingIntent intent)

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

Inherited methods

Public constructors

GridBuilder.CellBuilder

public GridBuilder.CellBuilder (GridBuilder parent)

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

Parameters
parent GridBuilder: The builder constructing the parent slice.

GridBuilder.CellBuilder

public GridBuilder.CellBuilder (GridBuilder parent, 
                Uri uri)

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

Parameters
parent GridBuilder

uri Uri: Uri to tag for this slice.

Public methods

addImage

public GridBuilder.CellBuilder addImage (Icon image, 
                boolean isLoading)

This method is deprecated.
TO BE REMOVED

Parameters
image Icon

isLoading boolean

Returns
GridBuilder.CellBuilder

addImage

public GridBuilder.CellBuilder addImage (IconCompat image, 
                int imageMode)

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 int: the mode that image should be displayed in.

Returns
GridBuilder.CellBuilder

addImage

public GridBuilder.CellBuilder addImage (Icon image, 
                int imageMode, 
                boolean isLoading)

This method is deprecated.
TO BE REMOVED

Parameters
image Icon

imageMode int

isLoading boolean

Returns
GridBuilder.CellBuilder

addImage

public GridBuilder.CellBuilder addImage (IconCompat image, 
                int imageMode, 
                boolean isLoading)

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 int: the mode that image should be displayed in.

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

Returns
GridBuilder.CellBuilder

addImage

public GridBuilder.CellBuilder addImage (Icon image)

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.

Returns
GridBuilder.CellBuilder

addImage

public GridBuilder.CellBuilder addImage (Icon image, 
                int imageMode)

This method is deprecated.
TO BE REMOVED

Parameters
image Icon

imageMode int

Returns
GridBuilder.CellBuilder

addLargeImage

public GridBuilder.CellBuilder addLargeImage (Icon image, 
                boolean isLoading)

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
image Icon

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

Returns
GridBuilder.CellBuilder

addLargeImage

public GridBuilder.CellBuilder addLargeImage (Icon image)

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.

Returns
GridBuilder.CellBuilder

addText

public GridBuilder.CellBuilder addText (CharSequence text)

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

Parameters
text CharSequence

Returns
GridBuilder.CellBuilder

addText

public GridBuilder.CellBuilder addText (CharSequence text, 
                boolean isLoading)

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
text CharSequence

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

Returns
GridBuilder.CellBuilder

addTitleText

public GridBuilder.CellBuilder addTitleText (CharSequence text, 
                boolean isLoading)

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
text CharSequence

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

Returns
GridBuilder.CellBuilder

addTitleText

public GridBuilder.CellBuilder addTitleText (CharSequence text)

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.

Parameters
text CharSequence

Returns
GridBuilder.CellBuilder

setContentDescription

public GridBuilder.CellBuilder setContentDescription (CharSequence description)

Sets the content description for this cell.

Parameters
description CharSequence

Returns
GridBuilder.CellBuilder

setContentIntent

public GridBuilder.CellBuilder setContentIntent (PendingIntent intent)

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

Parameters
intent PendingIntent

Returns
GridBuilder.CellBuilder