ControlTemplate

public abstract class ControlTemplate
extends Object

java.lang.Object
   ↳ android.service.controls.templates.ControlTemplate


An abstract input template for a Control. Specifies what layout is presented to the user for a given Control.

Some instances of Control can originate actions (via user interaction) to modify its associated state. The actions available to a given Control are determined by its ControlTemplate.

See also:

Summary

Constants

int TYPE_ERROR

Type identifier of the template returned by getErrorTemplate().

int TYPE_NO_TEMPLATE

Type identifier of ControlTemplate#getNoTemplateObject.

int TYPE_RANGE

Type identifier of RangeTemplate.

int TYPE_STATELESS

Type identifier of StatelessTemplate.

int TYPE_TEMPERATURE

Type identifier of TemperatureControlTemplate.

int TYPE_THUMBNAIL

Type identifier of ThumbnailTemplate.

int TYPE_TOGGLE

Type identifier of ToggleTemplate.

int TYPE_TOGGLE_RANGE

Type identifier of ToggleRangeTemplate.

Public methods

static ControlTemplate getErrorTemplate()
static ControlTemplate getNoTemplateObject()

Get a singleton ControlTemplate, which supports no direct user input.

String getTemplateId()
abstract int getTemplateType()

The template type associated with this class.

Inherited methods

Constants

TYPE_ERROR

Added in API level 30
public static final int TYPE_ERROR

Type identifier of the template returned by getErrorTemplate().
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: -1 (0xffffffff)

TYPE_NO_TEMPLATE

Added in API level 30
public static final int TYPE_NO_TEMPLATE

Type identifier of ControlTemplate#getNoTemplateObject.
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: 0 (0x00000000)

TYPE_RANGE

Added in API level 30
public static final int TYPE_RANGE

Type identifier of RangeTemplate.
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: 2 (0x00000002)

TYPE_STATELESS

Added in API level 30
public static final int TYPE_STATELESS

Type identifier of StatelessTemplate.
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: 8 (0x00000008)

TYPE_TEMPERATURE

Added in API level 30
public static final int TYPE_TEMPERATURE

Type identifier of TemperatureControlTemplate.
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: 7 (0x00000007)

TYPE_THUMBNAIL

Added in API level 31
public static final int TYPE_THUMBNAIL

Type identifier of ThumbnailTemplate.
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: 3 (0x00000003)

TYPE_TOGGLE

Added in API level 30
public static final int TYPE_TOGGLE

Type identifier of ToggleTemplate.
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: 1 (0x00000001)

TYPE_TOGGLE_RANGE

Added in API level 30
public static final int TYPE_TOGGLE_RANGE

Type identifier of ToggleRangeTemplate.
Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS

Constant Value: 6 (0x00000006)

Public methods

getErrorTemplate

Added in API level 30
public static ControlTemplate getErrorTemplate ()

Returns
ControlTemplate a singleton ControlTemplate used for indicating an error in unparceling. This value cannot be null.

getNoTemplateObject

Added in API level 30
public static ControlTemplate getNoTemplateObject ()

Get a singleton ControlTemplate, which supports no direct user input. Used by Control.StatelessBuilder when there is no known state. Can also be used in Control.StatefulBuilder for conveying information to a user about the Control but direct user interaction is not desired. Since this template has no corresponding ControlAction, any user interaction will launch the Control#getAppIntent().

Returns
ControlTemplate a singleton ControlTemplate to indicate no specific template is used by this Control This value cannot be null.

getTemplateId

Added in API level 30
public String getTemplateId ()

Returns
String the identifier for this object. This value cannot be null.

getTemplateType

Added in API level 30
public abstract int getTemplateType ()

The template type associated with this class.

Returns
int Value is TYPE_ERROR, TYPE_NO_TEMPLATE, TYPE_TOGGLE, TYPE_RANGE, TYPE_THUMBNAIL, TYPE_TOGGLE_RANGE, TYPE_TEMPERATURE, or TYPE_STATELESS