use of org.edx.mobile.discussion.DiscussionService.VoteBody in project edx-app-android by edx.
the class CourseDiscussionResponsesAdapter method bindSocialView.
private void bindSocialView(DiscussionSocialLayoutViewHolder holder, final int position, final DiscussionComment response) {
holder.setDiscussionResponse(response);
holder.voteViewContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
discussionService.setCommentVoted(response.getIdentifier(), new VoteBody(!response.isVoted())).enqueue(new ErrorHandlingCallback<DiscussionComment>(context, null, new DialogErrorNotification(baseFragment)) {
@Override
protected void onResponse(@NonNull final DiscussionComment comment) {
discussionResponses.get(position - 1).patchObject(comment);
discussionResponses.set(position - 1, comment);
notifyItemChanged(position);
}
});
}
});
}
use of org.edx.mobile.discussion.DiscussionService.VoteBody in project edx-app-android by edx.
the class CourseDiscussionResponsesAdapter method bindSocialView.
private void bindSocialView(DiscussionSocialLayoutViewHolder holder, DiscussionThread thread) {
holder.setDiscussionThread(thread);
holder.voteViewContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
discussionService.setThreadVoted(discussionThread.getIdentifier(), new VoteBody(!discussionThread.isVoted())).enqueue(new ErrorHandlingCallback<DiscussionThread>(context, null, new DialogErrorNotification(baseFragment)) {
@Override
protected void onResponse(@NonNull final DiscussionThread updatedDiscussionThread) {
discussionThread = discussionThread.patchObject(updatedDiscussionThread);
notifyItemChanged(0);
EventBus.getDefault().post(new DiscussionThreadUpdatedEvent(discussionThread));
}
});
}
});
holder.threadFollowContainer.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
discussionService.setThreadFollowed(discussionThread.getIdentifier(), new FollowBody(!discussionThread.isFollowing())).enqueue(new ErrorHandlingCallback<DiscussionThread>(context, null, new DialogErrorNotification(baseFragment)) {
@Override
protected void onResponse(@NonNull final DiscussionThread updatedDiscussionThread) {
discussionThread = discussionThread.patchObject(updatedDiscussionThread);
notifyItemChanged(0);
EventBus.getDefault().post(new DiscussionThreadUpdatedEvent(discussionThread));
}
});
}
});
}
Aggregations