LightState
public
final
class
LightState
extends Object
implements
Parcelable
java.lang.Object | |
↳ | android.hardware.lights.LightState |
Represents the state of a device light.
Controlling the color and brightness of a light is done on a best-effort basis. Each of the R, G and B channels represent the intensities of the respective part of an RGB LED, if that is supported. For devices that only support on or off lights, everything that's not off will turn the light on. If the light is monochrome and only the brightness can be controlled, the RGB color will be converted to only a brightness value and that will be used for the light's single channel.
Summary
Nested classes | |
---|---|
class |
LightState.Builder
Builder for creating device light change requests. |
Inherited constants |
---|
Fields | |
---|---|
public
static
final
Creator<LightState> |
CREATOR
|
Public methods | |
---|---|
int
|
describeContents()
Describe the kinds of special objects contained in this Parcelable instance's marshaled representation. |
int
|
getColor()
Returns the color and intensity associated with this LightState. |
int
|
getPlayerId()
Returns the player ID associated with this LightState for Light with type
|
String
|
toString()
Returns a string representation of the object. |
void
|
writeToParcel(Parcel dest, int flags)
Flatten this object in to a Parcel. |
Inherited methods | |
---|---|
Fields
Public methods
describeContents
public int describeContents ()
Describe the kinds of special objects contained in this Parcelable
instance's marshaled representation. For example, if the object will
include a file descriptor in the output of writeToParcel(android.os.Parcel, int)
,
the return value of this method must include the
CONTENTS_FILE_DESCRIPTOR
bit.
Returns | |
---|---|
int |
a bitmask indicating the set of special object types marshaled
by this Parcelable object instance.
Value is either 0 or CONTENTS_FILE_DESCRIPTOR |
getColor
public int getColor ()
Returns the color and intensity associated with this LightState.
Returns | |
---|---|
int |
the color and intensity in ARGB format. The A channel is ignored. return 0 when
calling LightsManager.getLightState with
Light.LIGHT_TYPE_PLAYER_ID . |
getPlayerId
public int getPlayerId ()
Returns the player ID associated with this LightState for Light with type
Light.LIGHT_TYPE_PLAYER_ID
,
or 0 for other types.
Returns | |
---|---|
int |
the player ID. |
toString
public String toString ()
Returns a string representation of the object.
Returns | |
---|---|
String |
a string representation of the object. |
writeToParcel
public void writeToParcel (Parcel dest, int flags)
Flatten this object in to a Parcel.
Parameters | |
---|---|
dest |
Parcel : This value cannot be null . |
flags |
int : Additional flags about how the object should be written.
May be 0 or Parcelable.PARCELABLE_WRITE_RETURN_VALUE .
Value is either 0 or a combination of Parcelable.PARCELABLE_WRITE_RETURN_VALUE , and android.os.Parcelable.PARCELABLE_ELIDE_DUPLICATES |
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2024-04-11 UTC.