Exemplo n.º 1
0
  private void onLoadCommentListResponse(
      boolean successful, CommentList result, VolleyError error, LoadCommentListState state) {

    if (successful) {
      List<Comment> commentList = result.comments;
      mCanLoadMoreComments = commentList.size() == state.count;
      if (state.loadMore) {
        mCommentAdapter.addAll(commentList);
      } else {
        mCommentAdapter.replace(commentList);
      }
    } else {
      LogUtils.e(error.toString());
      ToastUtils.show(ApiError.getErrorString(error, this), this);
    }

    setCommentsRefreshing(false, state.loadMore);
    mLoadingBroadcastOrCommentList = false;

    if (successful) {
      fixCommentCount();
    }
  }