T
- type of value heldpublic class DynamicValue<T>
extends java.lang.Object
set(Object)
It also allows attaching listeners (package level access),
and takes care of notifying them when the held value changes.
Nullsafe annotation have been removed from this file as infer asks for a T!! type in Kotlin 1.5 progressive and T & Any type in 1.6 progressive
Constructor and Description |
---|
DynamicValue(T mValue) |
Modifier and Type | Method and Description |
---|---|
T |
get()
Retrieves the current value.
|
void |
set(T value)
Sets current value and notifies all the attached listeners
|
public DynamicValue(T mValue)
public void set(T value)
IMPORTANT: This should only be called from the main thread! If it isn't, it can race with other set() calls!
value
- the new valuepublic T get()
IMPORTANT: This should only be called from the main thread! If it isn't, it can race with other set() calls! Generally, you shouldn't need to call get() yourself: instead the DynamicValue should be passed into a property or Style which accepts a DynamicValue.