Added in API level 30

RangeTemplate


class RangeTemplate : ControlTemplate

A template for a Control with inputs in a "continuous" range of values.

Summary

Inherited constants
Int TYPE_ERROR

Type identifier of the template returned by getErrorTemplate().
Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS

Int TYPE_NO_TEMPLATE

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

Int TYPE_RANGE

Type identifier of RangeTemplate.
Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS

Int TYPE_STATELESS

Type identifier of StatelessTemplate.
Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS

Int TYPE_TEMPERATURE

Type identifier of TemperatureControlTemplate.
Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS

Int TYPE_THUMBNAIL

Type identifier of ThumbnailTemplate.
Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS

Int TYPE_TOGGLE

Type identifier of ToggleTemplate.
Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS

Int TYPE_TOGGLE_RANGE

Type identifier of ToggleRangeTemplate.
Value is android.service.controls.templates.ControlTemplate#TYPE_ERROR, android.service.controls.templates.ControlTemplate#TYPE_NO_TEMPLATE, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE, android.service.controls.templates.ControlTemplate#TYPE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_THUMBNAIL, android.service.controls.templates.ControlTemplate#TYPE_TOGGLE_RANGE, android.service.controls.templates.ControlTemplate#TYPE_TEMPERATURE, or android.service.controls.templates.ControlTemplate#TYPE_STATELESS

Public constructors
RangeTemplate(templateId: String, minValue: Float, maxValue: Float, currentValue: Float, stepValue: Float, formatString: CharSequence?)

Construct a new RangeTemplate.

Public methods
Float

The current value for this range.

CharSequence

Formatter for generating a user visible String representing the value returned by RangeTemplate.getCurrentValue.

Float

The maximum value for this range.

Float

The minimum value for this range.

Float

The value of the smallest increment or decrement that can be performed on this range.

Int

Inherited functions
ControlTemplate getErrorTemplate()

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().

String getTemplateId()

Public constructors

RangeTemplate

Added in API level 30
RangeTemplate(
    templateId: String,
    minValue: Float,
    maxValue: Float,
    currentValue: Float,
    stepValue: Float,
    formatString: CharSequence?)

Construct a new RangeTemplate. The range must be valid, meaning:

  • minValue < maxValue
  • minValue < currentValue
  • currentValue < maxValue
  • 0 < stepValue

The current value of the Control will be formatted accordingly.

Parameters
templateId String: the identifier for this template object This value cannot be null.
minValue Float: minimum value for the input
maxValue Float: maximum value for the input
currentValue Float: the current value of the Control containing this object.
stepValue Float: minimum value of increments/decrements when interacting with this control.
formatString CharSequence?: a formatting string as per java.lang.String#format used to display the currentValue. If null is passed, the "%.1f" is used.
Exceptions
java.lang.IllegalArgumentException if the parameters passed do not make a valid range.

Public methods

getCurrentValue

Added in API level 30
fun getCurrentValue(): Float

The current value for this range.

getFormatString

Added in API level 30
fun getFormatString(): CharSequence

Formatter for generating a user visible String representing the value returned by RangeTemplate.getCurrentValue.

Return
CharSequence a formatting string as specified in java.lang.String#format This value cannot be null.

getMaxValue

Added in API level 30
fun getMaxValue(): Float

The maximum value for this range.

getMinValue

Added in API level 30
fun getMinValue(): Float

The minimum value for this range.

getStepValue

Added in API level 30
fun getStepValue(): Float

The value of the smallest increment or decrement that can be performed on this range.

getTemplateType

Added in API level 30
fun getTemplateType(): Int