Last active
June 11, 2016 13:00
-
-
Save Diolor/76c65fcc128687845114a561a2cb9ad0 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
PublishSubject<Void> viewClickedSubject = PublishSubject.create(); | |
CompositeSubscription startStopCompositeSubscription = new CompositeSubscription(); | |
protected void onStart() { | |
view.setOnClickListener(v-> viewClickedSubject.onNext(null)); | |
Subscription subscription = viewClickedSubject | |
.flatMap(aVoid-> api.getAlert()) | |
.subscribe(this::makeAlertToast, Throwable::printStackTrace); | |
startStopCompositeSubscription.add(subscription); | |
} | |
protected void onStop() { | |
startStopCompositeSubscription.clear(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment