Exemplo n.º 1
0
  private void sendComment(String comment) {

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

    setSendingComment(true);
  }
Exemplo n.º 2
0
 @Override
 public void deleteBroadcast() {
   RequestFragment.startRequest(
       REQUEST_CODE_DELETE_BROADCAST,
       ApiRequests.newDeleteBroadcastRequest(mBroadcastId, this),
       null,
       this);
 }
Exemplo n.º 3
0
 @Override
 public void deleteComment(Comment comment) {
   RequestFragment.startRequest(
       REQUEST_CODE_DELETE_COMMENT,
       ApiRequests.newDeleteBroadcastCommentRequest(mBroadcastId, comment.id, this),
       new DeleteCommentState(comment.id),
       this);
 }
Exemplo n.º 4
0
  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);
  }
Exemplo n.º 5
0
  @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;
  }
Exemplo n.º 6
0
  @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;
  }
Exemplo n.º 7
0
  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);
  }