Added in API level 30
ToggleTemplate
public
final
class
ToggleTemplate
extends ControlTemplate
java.lang.Object | ||
↳ | android.service.controls.templates.ControlTemplate | |
↳ | android.service.controls.templates.ToggleTemplate |
A template for a Control
with a single button that can be toggled between two states.
The states for the toggle correspond to the states in ControlButton#isChecked()
.
An action on this template will originate a BooleanAction
to change that state.
See also:
Summary
Inherited constants |
---|
Public constructors | |
---|---|
ToggleTemplate(String templateId, ControlButton button)
|
Public methods | |
---|---|
CharSequence
|
getContentDescription()
|
int
|
getTemplateType()
The template type associated with this class. |
boolean
|
isChecked()
|
Inherited methods | |
---|---|
Public constructors
ToggleTemplate
Added in API level 30
public ToggleTemplate (String templateId, ControlButton button)
Parameters | |
---|---|
templateId |
String : the identifier for this template object
This value cannot be null . |
button |
ControlButton : a ControlButton that can show the current state and toggle it
This value cannot be null . |
Public methods
getContentDescription
Added in API level 30
public CharSequence getContentDescription ()
Returns | |
---|---|
CharSequence |
This value cannot be null . |
getTemplateType
Added in API level 30
public int getTemplateType ()
The template type associated with this class.
Returns | |
---|---|
int |
ControlTemplate#TYPE_TOGGLE |