-
- All Implemented Interfaces:
-
androidx.lifecycle.LifecycleOwner,com.airbnb.mvrx.MavericksView
public interface MvRxView implements MavericksViewImplement this in your MvRx capable Fragment.
When you get a ViewModel with fragmentViewModel, activityViewModel, or existingViewModel, it will automatically subscribe to all state changes in the ViewModel and call invalidate.
-
-
Method Summary
Modifier and Type Method Description <S extends MavericksState> <ERROR CLASS>subscribe(BaseMvRxViewModel<S> $self, DeliveryMode deliveryMode, Function1<S, Unit> subscriber)Subscribes to all state updates for the given viewModel. <S extends MavericksState, A extends Any> <ERROR CLASS>selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, DeliveryMode deliveryMode, Function1<A, Unit> subscriber)Subscribes to state changes for only a specific property and calls the subscribe with only that single property. <S extends MavericksState, A extends Any, B extends Any> <ERROR CLASS>selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, DeliveryMode deliveryMode, Function2<A, B, Unit> subscriber)Subscribes to state changes for two properties. <S extends MavericksState, A extends Any, B extends Any, C extends Any> <ERROR CLASS>selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, DeliveryMode deliveryMode, Function3<A, B, C, Unit> subscriber)Subscribes to state changes for three properties. <S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any> <ERROR CLASS>selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, DeliveryMode deliveryMode, Function4<A, B, C, D, Unit> subscriber)Subscribes to state changes for four properties. <S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any, E extends Any> <ERROR CLASS>selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, KProperty1<S, E> prop5, DeliveryMode deliveryMode, Function5<A, B, C, D, E, Unit> subscriber)Subscribes to state changes for five properties. <S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any, E extends Any, F extends Any> <ERROR CLASS>selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, KProperty1<S, E> prop5, KProperty1<S, F> prop6, DeliveryMode deliveryMode, Function6<A, B, C, D, E, F, Unit> subscriber)Subscribes to state changes for six properties. <S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any, E extends Any, F extends Any, G extends Any> <ERROR CLASS>selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, KProperty1<S, E> prop5, KProperty1<S, F> prop6, KProperty1<S, G> prop7, DeliveryMode deliveryMode, Function7<A, B, C, D, E, F, G, Unit> subscriber)Subscribes to state changes for seven properties. <S extends MavericksState, T extends Any> <ERROR CLASS>asyncSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, Async<T>> asyncProp, DeliveryMode deliveryMode, Function1<Throwable, Unit> onFail, Function1<T, Unit> onSuccess)Subscribe to changes in an async property. abstract LifecyclegetLifecycle()MavericksViewInternalViewModelgetMavericksViewInternalViewModel()StringgetMvrxViewId()LifecycleOwnergetSubscriptionLifecycleOwner()-
Methods inherited from class com.airbnb.mvrx.MvRxView
collectLatest, invalidate, onAsync, onEach, onEach, onEach, onEach, onEach, onEach, onEach, onEach, postInvalidate, uniqueOnly -
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
-
Method Detail
-
subscribe
<S extends MavericksState> <ERROR CLASS> subscribe(BaseMvRxViewModel<S> $self, DeliveryMode deliveryMode, Function1<S, Unit> subscriber)
Subscribes to all state updates for the given viewModel.
- Parameters:
deliveryMode- If UniqueOnly when this MvRxView goes from a stopped to started lifecycle a state value will only be emitted if the state changed.
-
selectSubscribe
<S extends MavericksState, A extends Any> <ERROR CLASS> selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, DeliveryMode deliveryMode, Function1<A, Unit> subscriber)
Subscribes to state changes for only a specific property and calls the subscribe with only that single property.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
selectSubscribe
<S extends MavericksState, A extends Any, B extends Any> <ERROR CLASS> selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, DeliveryMode deliveryMode, Function2<A, B, Unit> subscriber)
Subscribes to state changes for two properties.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
selectSubscribe
<S extends MavericksState, A extends Any, B extends Any, C extends Any> <ERROR CLASS> selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, DeliveryMode deliveryMode, Function3<A, B, C, Unit> subscriber)
Subscribes to state changes for three properties.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
selectSubscribe
<S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any> <ERROR CLASS> selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, DeliveryMode deliveryMode, Function4<A, B, C, D, Unit> subscriber)
Subscribes to state changes for four properties.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
selectSubscribe
<S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any, E extends Any> <ERROR CLASS> selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, KProperty1<S, E> prop5, DeliveryMode deliveryMode, Function5<A, B, C, D, E, Unit> subscriber)
Subscribes to state changes for five properties.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
selectSubscribe
<S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any, E extends Any, F extends Any> <ERROR CLASS> selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, KProperty1<S, E> prop5, KProperty1<S, F> prop6, DeliveryMode deliveryMode, Function6<A, B, C, D, E, F, Unit> subscriber)
Subscribes to state changes for six properties.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
selectSubscribe
<S extends MavericksState, A extends Any, B extends Any, C extends Any, D extends Any, E extends Any, F extends Any, G extends Any> <ERROR CLASS> selectSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, A> prop1, KProperty1<S, B> prop2, KProperty1<S, C> prop3, KProperty1<S, D> prop4, KProperty1<S, E> prop5, KProperty1<S, F> prop6, KProperty1<S, G> prop7, DeliveryMode deliveryMode, Function7<A, B, C, D, E, F, G, Unit> subscriber)
Subscribes to state changes for seven properties.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
asyncSubscribe
<S extends MavericksState, T extends Any> <ERROR CLASS> asyncSubscribe(BaseMvRxViewModel<S> $self, KProperty1<S, Async<T>> asyncProp, DeliveryMode deliveryMode, Function1<Throwable, Unit> onFail, Function1<T, Unit> onSuccess)
Subscribe to changes in an async property. There are optional parameters for onSuccess and onFail which automatically unwrap the value or error.
- Parameters:
deliveryMode- If UniqueOnly, when this MvRxView goes from a stopped to start lifecycle a state value will only be emitted if the state changed.
-
getLifecycle
abstract Lifecycle getLifecycle()
-
getMavericksViewInternalViewModel
MavericksViewInternalViewModel getMavericksViewInternalViewModel()
-
getMvrxViewId
String getMvrxViewId()
-
getSubscriptionLifecycleOwner
LifecycleOwner getSubscriptionLifecycleOwner()
-
-
-
-