RangeTemplate
class RangeTemplate : ControlTemplate
| kotlin.Any | ||
| ↳ | android.service.controls.templates.ControlTemplate | |
| ↳ | android.service.controls.templates.RangeTemplate | |
A template for a Control with inputs in a "continuous" range of values.
Summary
| Inherited constants | |
|---|---|
| Public constructors | |
|---|---|
RangeTemplate(templateId: String, minValue: Float, maxValue: Float, currentValue: Float, stepValue: Float, formatString: CharSequence?)Construct a new |
|
| Public methods | |
|---|---|
| Float |
The current value for this range. |
| CharSequence |
Formatter for generating a user visible |
| 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 | |
|---|---|
Public constructors
RangeTemplate
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
fun getCurrentValue(): Float
The current value for this range.
getFormatString
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. |
getStepValue
fun getStepValue(): Float
The value of the smallest increment or decrement that can be performed on this range.
getTemplateType
fun getTemplateType(): Int
| Return | |
|---|---|
Int |
ControlTemplate.TYPE_RANGE |