class ChamberField<T> : LifecycleObserver
ChamberField is an interactive class to the internal Chamber data holder (ChamberStore) and a lifecycleObserver that can be observable. It should be used with com.skydoves.chamber.annotation.ShareProperty annotation that has a key name.
If we want to use the same synchronized value on the same custom scope and different classes, we should use the same key.
ChamberField(value: T)
ChamberField is an interactive class to the internal Chamber data holder (ChamberStore) and a lifecycleObserver that can be observable. It should be used with com.skydoves.chamber.annotation.ShareProperty annotation that has a key name. |
lateinit var annotation: Annotation |
|
var initialized: Boolean |
|
lateinit var key: String |
|
var value: T |
fun observe(observer: ChamberFieldObserver<T>): Unit
sets ChamberFieldObserver to observe value data change. fun observe(block: (t: T) -> Unit): Unit
sets ChamberFieldObserver to observe value data change using block. |
|
fun onResume(): Unit
when lifecycle state is onResume, the value value will be updated from local storage. |
|
fun postValue(value: T): Unit
sets value on the worker thread and post the value to the main thread. |