Package 

Interface MvRxView

  • All Implemented Interfaces:
    androidx.lifecycle.LifecycleOwner , com.airbnb.mvrx.MavericksView

    
    public interface MvRxView
     implements MavericksView
                        

    Implement 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 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.
      • 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.