コード例 #1
0
ファイル: BroadcastActivity.java プロジェクト: xyhrun/Douya
  private void sendComment(String comment) {

    ApiRequest<Comment> request =
        ApiRequests.newSendBroadcastCommentRequest(mBroadcastId, comment, this);
    RequestFragment.startRequest(REQUEST_CODE_SEND_COMMENT, request, null, this);

    setSendingComment(true);
  }
コード例 #2
0
ファイル: BroadcastActivity.java プロジェクト: xyhrun/Douya
 @Override
 public void deleteBroadcast() {
   RequestFragment.startRequest(
       REQUEST_CODE_DELETE_BROADCAST,
       ApiRequests.newDeleteBroadcastRequest(mBroadcastId, this),
       null,
       this);
 }
コード例 #3
0
ファイル: BroadcastActivity.java プロジェクト: xyhrun/Douya
 @Override
 public void deleteComment(Comment comment) {
   RequestFragment.startRequest(
       REQUEST_CODE_DELETE_COMMENT,
       ApiRequests.newDeleteBroadcastCommentRequest(mBroadcastId, comment.id, this),
       new DeleteCommentState(comment.id),
       this);
 }
コード例 #4
0
ファイル: BroadcastActivity.java プロジェクト: xyhrun/Douya
  private void loadBroadcast(boolean loadCommentList) {

    if (mLoadingBroadcastOrCommentList) {
      return;
    }

    ApiRequest<Broadcast> request = ApiRequests.newBroadcastRequest(mBroadcastId, this);
    LoadBroadcastState state = new LoadBroadcastState(loadCommentList);
    RequestFragment.startRequest(REQUEST_CODE_LOAD_BROADCAST, request, state, this);

    mLoadingBroadcastOrCommentList = true;
    setBroadcastRefreshing(true);
  }
コード例 #5
0
ファイル: BroadcastActivity.java プロジェクト: xyhrun/Douya
  @Override
  public boolean onLike(boolean like) {

    if (mBroadcastAdapter.hasBroadcast()
        && mBroadcastAdapter.getBroadcast().author.id == AccountUtils.getUserId(this)) {
      ToastUtils.show(R.string.broadcast_like_error_cannot_like_oneself, this);
      return false;
    }

    ApiRequest<Broadcast> request = ApiRequests.newLikeBroadcastRequest(mBroadcastId, like, this);
    LikeState state = new LikeState(like);
    RequestFragment.startRequest(REQUEST_CODE_LIKE, request, state, this);
    return true;
  }
コード例 #6
0
ファイル: BroadcastActivity.java プロジェクト: xyhrun/Douya
  @Override
  public boolean onRebroadcast(boolean rebroadcast) {

    if (mBroadcastAdapter.hasBroadcast()
        && mBroadcastAdapter.getBroadcast().author.id == AccountUtils.getUserId(this)) {
      ToastUtils.show(R.string.broadcast_rebroadcast_error_cannot_rebroadcast_oneself, this);
      return false;
    }

    ApiRequest<Broadcast> request =
        ApiRequests.newRebroadcastBroadcastRequest(mBroadcastId, rebroadcast, this);
    RebroadcastState state = new RebroadcastState(rebroadcast);
    RequestFragment.startRequest(REQUEST_CODE_REBROADCAST, request, state, this);
    return true;
  }
コード例 #7
0
ファイル: BroadcastActivity.java プロジェクト: xyhrun/Douya
  private void loadCommentList(boolean loadMore) {

    if (mLoadingBroadcastOrCommentList || (loadMore && !mCanLoadMoreComments)) {
      return;
    }

    Integer start = loadMore ? mCommentAdapter.getItemCount() : null;
    final int count = COMMENT_COUNT_PER_LOAD;
    ApiRequest<CommentList> request =
        ApiRequests.newBroadcastCommentListRequest(mBroadcastId, start, count, this);
    LoadCommentListState state = new LoadCommentListState(loadMore, count);
    RequestFragment.startRequest(REQUEST_CODE_LOAD_COMMENT_LIST, request, state, this);

    mLoadingBroadcastOrCommentList = true;
    setCommentsRefreshing(true, loadMore);
  }