LifecycleAwareProperty

class LifecycleAwareProperty<T : Any>(lifecycleOwner: LifecycleOwner, value: T)

LifecycleAwareProperty is an observer for notifying lifecycle is changed.

Constructors

LifecycleAwareProperty
Link copied to clipboard
fun <T : Any> LifecycleAwareProperty(lifecycleOwner: LifecycleOwner, value: T)

Types

Builder
Link copied to clipboard
class Builder<T : Any>(lifecycleOwner: LifecycleOwner, value: T)
Builder class for creating LifecycleAwareProperty.

Functions

observeOn
Link copied to clipboard
fun observeOn(on: On, receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On lifecycle state.
observeOnAny
Link copied to clipboard
fun observeOnAny(receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On.ANY lifecycle state.
observeOnCreate
Link copied to clipboard
fun observeOnCreate(receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On.CREATE lifecycle state.
observeOnDestroy
Link copied to clipboard
fun observeOnDestroy(receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On.DESTROY lifecycle state.
observeOnPause
Link copied to clipboard
fun observeOnPause(receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On.PAUSE lifecycle state.
observeOnResume
Link copied to clipboard
fun observeOnResume(receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On.RESUME lifecycle state.
observeOnStart
Link copied to clipboard
fun observeOnStart(receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On.START lifecycle state.
observeOnStop
Link copied to clipboard
fun observeOnStop(receiver: T.() -> Unit): LifecycleAwareProperty<T>
observes on the On.STOP lifecycle state.

Properties

lifecycleOwner
Link copied to clipboard
val lifecycleOwner: LifecycleOwner
value
Link copied to clipboard
var value: T

Extensions

observe
Link copied to clipboard
inline fun <T : Any> LifecycleAwareProperty<T>.observe(block: LifecycleAwareProperty.Builder<T>.() -> Unit): LifecycleAwareProperty<T>