MultiLightEffect
class MultiLightEffect : Parcelable
| kotlin.Any | |
| ↳ | android.hardware.lights.MultiLightEffect |
Models an effect that will be shown in one or more lights.
Effects are comprised of [light, ColorSequence] pairs defining how each light should change over time along with some extra configuration values:
- Iterations: the number of times the effect will be played back to back.
- Preemptive: whether this effect should preempt any previously playing state or if it should be played after the current effect finishes.
A MultiLightEffect is treated as a unit with a given start time and an implicit duration:
- Start time: all lights sequences in the effect start at the same time, regardless of having a initial state or not.
- Duration: the duration of the effect is the duration of the longest sequence it contains. If a light sequence in the effect is shorter than the effect duration, the light will remain as a solid color until the end of the effect.
ColorSequences in the effect could have initial states (delay=0) for their corresponding lights, which has special implications when the effect will be played as a continuation of another effect (effects with preemptive=false and/or effects with initial states and more than one iteration).
The initial state will be applied only if the effect is set to preemptive and it is the first iteration of the effect. The system ignores the initial state in subsequent iterations or in effects with preemptive=false to allow the light to transition smoothly and avoid flicks.
Summary
| Nested classes | |
|---|---|
|
Builder for |
|
| Inherited constants | |
|---|---|
| Public methods | |
|---|---|
| Int |
Implement the Parcelable interface |
| Int |
Returns the number of times this effect will be played in a loop. |
| MutableMap<Int!, ColorSequence!> |
Returns the color sequences defined in the light effect for each of the lights. |
| Boolean |
Returns whether this effect will cancel any previously playing effect. |
| String |
toString() |
| Unit |
writeToParcel(dest: Parcel, flags: Int)Implement the Parcelable interface |
| Properties | |
|---|---|
| static Parcelable.Creator<MultiLightEffect!> |
Implement the Parcelable interface |
Public methods
describeContents
fun describeContents(): Int
Implement the Parcelable interface
| Return | |
|---|---|
Int |
a bitmask indicating the set of special object types marshaled by this Parcelable object instance. Value is either 0 or
|
getIterations
fun getIterations(): Int
Returns the number of times this effect will be played in a loop. Defaults to 1.
| Return | |
|---|---|
Int |
the number of iterations to play. |
getSequences
fun getSequences(): MutableMap<Int!, ColorSequence!>
Returns the color sequences defined in the light effect for each of the lights.
The key for the returned map corresponds to the lightId (see Light.getId()) of the light that will play the color sequence represented by the value.
| Return | |
|---|---|
MutableMap<Int!, ColorSequence!> |
the Map of lightIds to the color sequences that will be played for the effect. This value cannot be null. |
isPreemptive
fun isPreemptive(): Boolean
Returns whether this effect will cancel any previously playing effect.
| Return | |
|---|---|
Boolean |
true if this effect applies immediately, false otherwise. |
toString
fun toString(): String
writeToParcel
fun writeToParcel(
dest: Parcel,
flags: Int
): Unit
Implement the Parcelable interface
| Parameters | |
|---|---|
dest |
Parcel: This value cannot be null. |
flags |
Int: Additional flags about how the object should be written. May be 0 or PARCELABLE_WRITE_RETURN_VALUE. Value is either 0 or a combination of the following:
|
Properties
CREATOR
static val CREATOR: Parcelable.Creator<MultiLightEffect!>
Implement the Parcelable interface