public class ViewModelReactor<Action,Mutation,State> implements Reactor<Action,Mutation,State>
Abstract Reactor implementing ViewModel. It handles action and state creation and clearing of the state observable.
Reactor.DefaultImpls| Constructor and Description |
|---|
ViewModelReactor(State initialState,
State currentState)
Abstract Reactor implementing ViewModel.
It handles action and state creation and clearing of the state observable.
|
| Modifier and Type | Method and Description |
|---|---|
com.jakewharton.rxrelay2.PublishRelay<Action> |
getAction()
The action from the view. Bind user inputs to this subject.
|
State |
getCurrentState()
The current state.
|
io.reactivex.disposables.CompositeDisposable |
getDisposables()
The CompositeDisposable that contains the State Stream disposable.
|
State |
getInitialState()
The initial state.
|
io.reactivex.Observable<? extends State> |
getState()
The state stream. Use this observable to observe the state changes.
|
void |
onCleared() |
void |
setCurrentState(State p)
The current state.
|
createStateStream, getAction, getCurrentState, getDisposables, getInitialState, getState, mutate, reduce, setCurrentState, transformAction, transformMutation, transformStatepublic ViewModelReactor(State initialState,
State currentState)
Abstract Reactor implementing ViewModel. It handles action and state creation and clearing of the state observable.
initialState - The initial state.currentState - The current state. This value is changed just after the state stream emits a new state.public io.reactivex.disposables.CompositeDisposable getDisposables()
The CompositeDisposable that contains the State Stream disposable.
public com.jakewharton.rxrelay2.PublishRelay<Action> getAction()
The action from the view. Bind user inputs to this subject.
public io.reactivex.Observable<? extends State> getState()
The state stream. Use this observable to observe the state changes.
public void onCleared()
public State getInitialState()
The initial state.
public State getCurrentState()
The current state.
This value is changed just after the state stream emits a new state.
public void setCurrentState(State p)
The current state.
This value is changed just after the state stream emits a new state.
p - The current state. This value is changed just after the state stream emits a new state.