Added in API level 31

Builder

class Builder
kotlin.Any
   ↳ android.hardware.lights.LightState.Builder

Builder for creating device light change requests.

Summary

Public constructors

Creates a new LightState.Builder.

Public methods
LightState

Create a LightState object used to control lights on the device.

LightState.Builder
setColor(color: Int)

Set the desired color and intensity of the LightState Builder, for a light type of RBG color or single monochrome color.

LightState.Builder
setPlayerId(playerId: Int)

Set the desired player id of the LightState Builder, for a light with type android.hardware.lights.Light#LIGHT_TYPE_PLAYER_ID.

Public constructors

Builder

Added in API level 31
Builder()

Creates a new LightState.Builder.

Public methods

build

Added in API level 31
fun build(): LightState

Create a LightState object used to control lights on the device.

The generated LightState should be used in LightsRequest.Builder#addLight(Light, LightState).

Return
LightState This value cannot be null.

setColor

Added in API level 31
fun setColor(color: Int): LightState.Builder

Set the desired color and intensity of the LightState Builder, for a light type of RBG color or single monochrome color.

Parameters
color Int: the desired color and intensity in ARGB format.
Return
LightState.Builder The LightState.Builder object contains the light color and intensity. This value cannot be null.

setPlayerId

Added in API level 31
fun setPlayerId(playerId: Int): LightState.Builder

Set the desired player id of the LightState Builder, for a light with type android.hardware.lights.Light#LIGHT_TYPE_PLAYER_ID.

Parameters
playerId Int: the desired player id.
Return
LightState.Builder The LightState.Builder object contains the player id. This value cannot be null.