use of org.edx.mobile.discussion.DiscussionService.FollowBody 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