예제 #1
0
  /**
   * 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()));
  }
예제 #2
0
  public CommentsAdapter(String selfName) {
    this.selfName = selfName;

    setHasStableIds(true);
    set(emptyList(), emptyMap(), null);
  }