Created
October 24, 2017 07:30
-
-
Save sockeqwe/1deb00dc31e360f222e20e04e9ca9737 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MyFormPresenter extends MviBasePresenter<MyFormView, FormViewState> { | |
@Override | |
public void bindIntents(){ | |
Observable<FormViewState> state = intent( MyFormView::submitIntent) | |
.map(formInputData -> new FormViewState( isValidName(formInputData.name), isValidEmail(formInputData.email) ) ); | |
subscribeViewState(state, MyFormView::render) | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class FormInputData{ | |
String name; | |
String email; | |
} | |
class FormViewState { | |
boolean nameError; | |
boolean emailError; | |
} | |
interface MyFormView{ | |
Observable<FormInputData> submitIntent(); | |
void render(FormViewState state); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment