Created
April 14, 2017 15:41
-
-
Save benigumocom/3e942f4e39abc34153c2f6cef9f5f76c to your computer and use it in GitHub Desktop.
Managing State 1
This file contains hidden or 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
disposables.add(RxView.clicks(submitView) | |
.doOnNext(ignored -> { | |
submitView.setEnabled(false); | |
progressView.setVisibility(VISIBLE); | |
}) | |
.flatMap(ignored -> service.setName(nameView.getText().toString())) | |
.observeOn(AndroidSchedulers.mainThread()) | |
.doOnNext(ignored -> progressView.setVisibility(GONE)) | |
.subscribe(s -> finish(), t -> { | |
submitView.setEnabled(true); | |
Toast.makeText(this, "Failed to set name: " + t.getMessage(), LENGTH_SHORT).show(); | |
})); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment