/** * Displays the given list of comments combined with the voting for those comments. * * @param comments The list of comments to display. */ private void displayComments(List<Comment> comments) { this.comments = ImmutableList.copyOf(comments); // show now commentsAdapter.set(comments, emptyMap(), feedItem.getUser()); if (autoScrollTo.isPresent()) { scrollToComment(autoScrollTo.get()); autoScrollTo = Optional.absent(); } // load the votes for the comments and update, when we found any voteService .getCommentVotes(comments) .filter(votes -> !votes.isEmpty()) .onErrorResumeNext(empty()) .compose(bindToLifecycle()) .subscribe(votes -> commentsAdapter.set(comments, votes, feedItem.getUser())); }
public CommentsAdapter(String selfName) { this.selfName = selfName; setHasStableIds(true); set(emptyList(), emptyMap(), null); }