Skip to content

Instantly share code, notes, and snippets.

@objectiveSee
Created May 12, 2015 18:37
Show Gist options
  • Save objectiveSee/93325be98e637746956e to your computer and use it in GitHub Desktop.
Save objectiveSee/93325be98e637746956e to your computer and use it in GitHub Desktop.
ArrayList<String> cardIds = new ArrayList<>();
for (CardView.CardInfo c : cardsToDiscard) {
cardIds.add(c.getId());
}
bindFragmentLifecycle(lifecycle(),
gameManager.discardCards(game.getGameId(), cardIds)).observeOn(
AndroidSchedulers.mainThread()).subscribe(new Action1<Long>() {
@Override public void call(JSON json, ERROR error) {
View view = getView();
if (view == null) return;
exitDiscardMode();
if ( error ) {
Timber.e(throwable, "Error while discarding cards");
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment