WithLifecycleStateKt
public final class WithLifecycleStateKt
Summary
Public methods |
|
|---|---|
static final @NonNull R |
Run |
static final @NonNull R |
<R extends Object> withCreated(Run |
static final @NonNull R |
Run |
static final @NonNull R |
<R extends Object> withResumed(Run |
static final @NonNull R |
Run |
static final @NonNull R |
<R extends Object> withStarted(Run |
static final @NonNull R |
<R extends Object> withStateAtLeast(Run |
static final @NonNull R |
<R extends Object> withStateAtLeast(Run |
Public methods
withCreated
public static final @NonNull R <R extends Object> withCreated(
@NonNull Lifecycle receiver,
@NonNull Function0<@NonNull R> block
)
Run block with this Lifecycle in a Lifecycle.State of at least Lifecycle.State.CREATED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
withCreated
public static final @NonNull R <R extends Object> withCreated(
@NonNull LifecycleOwner receiver,
@NonNull Function0<@NonNull R> block
)
Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least Lifecycle.State.CREATED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
withResumed
public static final @NonNull R <R extends Object> withResumed(
@NonNull Lifecycle receiver,
@NonNull Function0<@NonNull R> block
)
Run block with this Lifecycle in a Lifecycle.State of at least Lifecycle.State.RESUMED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
withResumed
public static final @NonNull R <R extends Object> withResumed(
@NonNull LifecycleOwner receiver,
@NonNull Function0<@NonNull R> block
)
Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least Lifecycle.State.RESUMED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
withStarted
public static final @NonNull R <R extends Object> withStarted(
@NonNull Lifecycle receiver,
@NonNull Function0<@NonNull R> block
)
Run block with this Lifecycle in a Lifecycle.State of at least Lifecycle.State.STARTED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
withStarted
public static final @NonNull R <R extends Object> withStarted(
@NonNull LifecycleOwner receiver,
@NonNull Function0<@NonNull R> block
)
Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least Lifecycle.State.STARTED and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
withStateAtLeast
public static final @NonNull R <R extends Object> withStateAtLeast(
@NonNull Lifecycle receiver,
@NonNull Lifecycle.State state,
@NonNull Function0<@NonNull R> block
)
Run block with this Lifecycle in a Lifecycle.State of at least state and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.
withStateAtLeast
public static final @NonNull R <R extends Object> withStateAtLeast(
@NonNull LifecycleOwner receiver,
@NonNull Lifecycle.State state,
@NonNull Function0<@NonNull R> block
)
Run block with this LifecycleOwner's Lifecycle in a Lifecycle.State of at least state and resume with the result. Throws the CancellationException if the lifecycle has reached Lifecycle.State.DESTROYED by the time of the call or before block is able to run.