@Override public void deleteBroadcast() { RequestFragment.startRequest( REQUEST_CODE_DELETE_BROADCAST, ApiRequests.newDeleteBroadcastRequest(mBroadcastId, this), null, this); }
@Override public void deleteComment(Comment comment) { RequestFragment.startRequest( REQUEST_CODE_DELETE_COMMENT, ApiRequests.newDeleteBroadcastCommentRequest(mBroadcastId, comment.id, this), new DeleteCommentState(comment.id), this); }
private void sendComment(String comment) { ApiRequest<Comment> request = ApiRequests.newSendBroadcastCommentRequest(mBroadcastId, comment, this); RequestFragment.startRequest(REQUEST_CODE_SEND_COMMENT, request, null, this); setSendingComment(true); }
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); }
@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; }
@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; }
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); }
@Override protected ApiRequest<List<User>> onCreateRequest(Integer start, Integer count) { return ApiRequests.newBroadcastLikerListRequest(getBroadcastId(), start, count); }