public class RxLifecycle
extends java.lang.Object
| Modifier and Type | Method and Description |
|---|---|
static <T,R> LifecycleTransformer<T> |
bind(io.reactivex.Observable<R> lifecycle)
Binds the given source to a lifecycle.
|
static <T,R> LifecycleTransformer<T> |
bind(io.reactivex.Observable<R> lifecycle,
io.reactivex.functions.Function<R,R> correspondingEvents)
Binds the given source to a lifecycle.
|
static <T,R> LifecycleTransformer<T> |
bindUntilEvent(io.reactivex.Observable<R> lifecycle,
R event)
Binds the given source to a lifecycle.
|
@Nonnull @CheckReturnValue public static <T,R> LifecycleTransformer<T> bindUntilEvent(@Nonnull io.reactivex.Observable<R> lifecycle, @Nonnull R event)
When the lifecycle event occurs, the source will cease to emit any notifications.
lifecycle - the lifecycle sequenceevent - the event which should conclude notifications from the sourceLifecycleTransformer that unsubscribes the source at the specified event@Nonnull @CheckReturnValue public static <T,R> LifecycleTransformer<T> bind(@Nonnull io.reactivex.Observable<R> lifecycle)
This helper automatically determines (based on the lifecycle sequence itself) when the source should stop emitting items. Note that for this method, it assumes any event emitted by the given lifecycle indicates that the lifecycle is over.
lifecycle - the lifecycle sequenceLifecycleTransformer that unsubscribes the source whenever the lifecycle emits@Nonnull @CheckReturnValue public static <T,R> LifecycleTransformer<T> bind(@Nonnull io.reactivex.Observable<R> lifecycle, @Nonnull io.reactivex.functions.Function<R,R> correspondingEvents)
This method determines (based on the lifecycle sequence itself) when the source should stop emitting items. It uses the provided correspondingEvents function to determine when to unsubscribe.
Note that this is an advanced usage of the library and should generally be used only if you really know what you're doing with a given lifecycle.
lifecycle - the lifecycle sequencecorrespondingEvents - a function which tells the source when to unsubscribeLifecycleTransformer that unsubscribes the source during the Fragment lifecycle