Last active
June 18, 2017 21:15
-
-
Save marcin-adamczewski/3fb46c1ef2c68bbb1e4993f8b3639ed6 to your computer and use it in GitHub Desktop.
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
RxView.clicks(favButton) | |
.throttleFirst(1, TimeUnit.SECONDS) //Prevents from crazy clicks | |
.switchMap(ignore -> favoritesManager.addOrRemoveFromFavs(postId))//Toggle cache state and make API request | |
.subscribe(responseOrError -> { | |
if (responseOrError.isError()) { | |
Toast.makeText(PostDetailsActivity.this, "API error", Toast.LENGTH_SHORT).show(); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment