Control.StatefulBuilder  |  API reference  |  Android Developers


public static final class Control.StatefulBuilder
extends Object



Builder class for Control that contains state information. State information is passed through an instance of a ControlTemplate and will determine how the user can interact with the Control. User interactions will be sent through the method call ControlsProviderService.performControlAction with an instance of ControlAction to convey any potential new value. Must be used to provide controls for ControlsProviderService.createPublisherFor. It provides the following defaults for non-optional parameters:

Summary

Public constructors

StatefulBuilder(Control control)

Creates a StatelessBuilder using an existing Control as a base.

StatefulBuilder(String controlId, PendingIntent appIntent)

Public methods

Control build()
Control.StatefulBuilder setAppIntent(PendingIntent appIntent)
Control.StatefulBuilder setAuthRequired(boolean authRequired)
Control.StatefulBuilder setControlId(String controlId)
Control.StatefulBuilder setControlTemplate(ControlTemplate controlTemplate)

Set the ControlTemplate to define the primary user interaction Devices may support a variety of user interactions, and all interactions cannot be represented with a single ControlTemplate.

Control.StatefulBuilder setCustomColor(ColorStateList customColor)

Optional color to be shown with the Control.

Control.StatefulBuilder setCustomIcon(Icon customIcon)

Optional icon to be shown with the Control.

Control.StatefulBuilder setDeviceType(int deviceType)
Control.StatefulBuilder setStatus(int status)
Control.StatefulBuilder setStatusText(CharSequence statusText)
Control.StatefulBuilder setStructure(CharSequence structure)

Optional top-level group to help define the Control's location, visible to the user.

Control.StatefulBuilder setSubtitle(CharSequence subtitle)
Control.StatefulBuilder setTitle(CharSequence title)
Control.StatefulBuilder setZone(CharSequence zone)

Optional group name to help define the Control's location within a structure, visible to the user.

Inherited methods

From class java.lang.Object

Object clone()

Creates and returns a copy of this object.

boolean equals(Object obj)

Indicates whether some other object is "equal to" this one.

void finalize()

Called by the garbage collector on an object when garbage collection determines that there are no more references to the object.

final Class<?> getClass()

Returns the runtime class of this Object.

int hashCode()

Returns a hash code value for the object.

final void notify()

Wakes up a single thread that is waiting on this object's monitor.

final void notifyAll()

Wakes up all threads that are waiting on this object's monitor.

String toString()

Returns a string representation of the object.

final void wait(long timeoutMillis, int nanos)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait(long timeoutMillis)

Causes the current thread to wait until it is awakened, typically by being notified or interrupted, or until a certain amount of real time has elapsed.

final void wait()

Causes the current thread to wait until it is awakened, typically by being notified or interrupted.

Public constructors

StatefulBuilder

public StatefulBuilder (Control control)

Creates a StatelessBuilder using an existing Control as a base.

Parameters
control Control: base for the builder.
This value cannot be null.

StatefulBuilder

public StatefulBuilder (String controlId, 
                PendingIntent appIntent)
Parameters
controlId String: the identifier for the Control.
This value cannot be null.
appIntent PendingIntent: the pending intent linking to the device Activity.
This value cannot be null.

Public methods

setAuthRequired

public Control.StatefulBuilder setAuthRequired (boolean authRequired)
Parameters
authRequired boolean: true if the control can not be interacted with until the device is unlocked
Returns
Control.StatefulBuilder this
This value cannot be null.

setControlTemplate

public Control.StatefulBuilder setControlTemplate (ControlTemplate controlTemplate)

Set the ControlTemplate to define the primary user interaction Devices may support a variety of user interactions, and all interactions cannot be represented with a single ControlTemplate. Therefore, the selected template should be most closely aligned with what the expected primary device action will be. Any secondary interactions can be done via the setAppIntent(PendingIntent).

Parameters
controlTemplate ControlTemplate: instance of ControlTemplate, that defines how the Control will behave and what interactions are available to the user.
This value cannot be null.
Returns
Control.StatefulBuilder this
This value cannot be null.

setCustomColor

public Control.StatefulBuilder setCustomColor (ColorStateList customColor)

Optional color to be shown with the Control. It is highly recommended to let the system default the color unless the default is not suitable for the application.

Parameters
customColor ColorStateList: background color to use.
This value may be null.
Returns
Control.StatefulBuilder this
This value cannot be null.

setCustomIcon

public Control.StatefulBuilder setCustomIcon (Icon customIcon)

Optional icon to be shown with the Control. It is highly recommended to let the system default the icon unless the default icon is not suitable.

Parameters
customIcon Icon: icon to show.
This value may be null.
Returns
Control.StatefulBuilder this
This value cannot be null.

setStructure

public Control.StatefulBuilder setStructure (CharSequence structure)

Optional top-level group to help define the Control's location, visible to the user. If not present, the application name will be used as the top-level group. A structure contains zones which contains controls.

Parameters
structure CharSequence: name of the structure containing the control.
This value may be null.
Returns
Control.StatefulBuilder this
This value cannot be null.

setZone

public Control.StatefulBuilder setZone (CharSequence zone)

Optional group name to help define the Control's location within a structure, visible to the user. A structure contains zones which contains controls.

Parameters
zone CharSequence: name of the zone containing the control.
This value may be null.
Returns
Control.StatefulBuilder this
This value cannot be null.