Lazybones

class Lazybones<out T : Any>(lifecycleOwner: LifecycleOwner, lazy: Lazy<T>) : Serializable

Lazybones is a wrapper class that initializes Lazy property based on the lifecycle.

Constructors

Lazybones
Link copied to clipboard
fun <out T : Any> Lazybones(lifecycleOwner: LifecycleOwner, lazy: Lazy<T>)

Functions

lazy
Link copied to clipboard
fun lazy(): Lazy<T>
initializes the value lazily.
onAny
Link copied to clipboard
fun onAny(receiver: T.() -> Unit): Lazybones<T>
returns a Lazybones and the receiver will be aware of On.ANY lifecycle state.
onCreate
Link copied to clipboard
fun onCreate(receiver: T.() -> Unit): Lazybones<T>
returns a Lazybones and the receiver will be aware of On.CREATE lifecycle state.
onDestroy
Link copied to clipboard
fun onDestroy(receiver: T.() -> Unit): Lazybones<T>
returns a Lazybones and the receiver will be aware of On.DESTROY lifecycle state.
onPause
Link copied to clipboard
fun onPause(receiver: T.() -> Unit): Lazybones<T>
returns a Lazybones and the receiver will be aware of On.PAUSE lifecycle state.
onResume
Link copied to clipboard
fun onResume(receiver: T.() -> Unit): Lazybones<T>
returns a Lazybones and the receiver will be aware of On.RESUME lifecycle state.
onStart
Link copied to clipboard
fun onStart(receiver: T.() -> Unit): Lazybones<T>
returns a Lazybones and the receiver will be aware of On.START lifecycle state.
onStop
Link copied to clipboard
fun onStop(receiver: T.() -> Unit): Lazybones<T>
returns a Lazybones and the receiver will be aware of On.STOP lifecycle state.
toString
Link copied to clipboard
open override fun toString(): String
value
Link copied to clipboard
fun value(): T
gets a value from the lazy class.