mvrx-rxjava2 / com.airbnb.mvrx / BaseMvRxFragment

BaseMvRxFragment

abstract class BaseMvRxFragment : Fragment, MvRxView
Deprecated: You no longer need a base MvRxFragment. All you need to do is make your Fragment implement MvRxView.

Make your base Fragment class extend this to get MvRx functionality.

This is necessary for the view model delegates and persistence to work correctly.

Constructors

<init>

BaseMvRxFragment(contentLayoutId: Int = 0)

Make your base Fragment class extend this to get MvRx functionality.

Inherited Functions

asyncSubscribe

open fun <S : MvRxState, T> BaseMvRxViewModel<S>.asyncSubscribe(asyncProp: KProperty1<S, Async<T>>, deliveryMode: DeliveryMode = RedeliverOnStart, onFail: ((Throwable) -> Unit)? = null, onSuccess: ((T) -> Unit)? = null): Disposable

Subscribe to changes in an async property. There are optional parameters for onSuccess and onFail which automatically unwrap the value or error.

selectSubscribe

open fun <S : MvRxState, A> BaseMvRxViewModel<S>.selectSubscribe(prop1: KProperty1<S, A>, deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (A) -> Unit): Disposable

Subscribes to state changes for only a specific property and calls the subscribe with only that single property.

open fun <S : MvRxState, A, B> BaseMvRxViewModel<S>.selectSubscribe(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (A, B) -> Unit): Disposable

Subscribes to state changes for two properties.

open fun <S : MvRxState, A, B, C> BaseMvRxViewModel<S>.selectSubscribe(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (A, B, C) -> Unit): Disposable

Subscribes to state changes for three properties.

open fun <S : MvRxState, A, B, C, D> BaseMvRxViewModel<S>.selectSubscribe(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (A, B, C, D) -> Unit): Disposable

Subscribes to state changes for four properties.

open fun <S : MvRxState, A, B, C, D, E> BaseMvRxViewModel<S>.selectSubscribe(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, prop5: KProperty1<S, E>, deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (A, B, C, D, E) -> Unit): Disposable

Subscribes to state changes for five properties.

open fun <S : MvRxState, A, B, C, D, E, F> BaseMvRxViewModel<S>.selectSubscribe(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, prop5: KProperty1<S, E>, prop6: KProperty1<S, F>, deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (A, B, C, D, E, F) -> Unit): Disposable

Subscribes to state changes for six properties.

open fun <S : MvRxState, A, B, C, D, E, F, G> BaseMvRxViewModel<S>.selectSubscribe(prop1: KProperty1<S, A>, prop2: KProperty1<S, B>, prop3: KProperty1<S, C>, prop4: KProperty1<S, D>, prop5: KProperty1<S, E>, prop6: KProperty1<S, F>, prop7: KProperty1<S, G>, deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (A, B, C, D, E, F, G) -> Unit): Disposable

Subscribes to state changes for seven properties.

subscribe

open fun <S : MvRxState> BaseMvRxViewModel<S>.subscribe(deliveryMode: DeliveryMode = RedeliverOnStart, subscriber: (S) -> Unit): Disposable

Subscribes to all state updates for the given viewModel.