Last active
January 30, 2018 14:25
-
-
Save HIFILEO/73d4d286f2f3952c12cb52a5034e3087 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
uiModelObservable = publishRelayUiEvents | |
.observeOn(Schedulers.computation()) | |
//Translate UiEvents into Actions | |
.compose(transformEventsIntoActions) | |
//Asynchronous Actions To Interactor | |
.publish(actionObservable -> nowPlayingInteractor.processAction(actionObservable)) | |
//Scan Results to Update UiModel | |
.scan(initialUiModel, (uiModel, result) -> { | |
if (result instanceof ScrollResult) { | |
return processScrollResult(uiModel, (ScrollResult) result); | |
} else if (result instanceof ***) { | |
return processRestoreResult(uiModel, (***) result); | |
} | |
throw new IllegalArgumentException("Unknown Result: " + result); | |
}) | |
//Publish results to main thread. | |
.observeOn(AndroidSchedulers.mainThread()) | |
//Save history for late subscribers. | |
.replay(1) | |
.autoConnect(); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment