use of com.fastaccess.data.dao.model.Comment in project FastHub by k0shk0sh.
the class TimelineCommentsViewHolder method addReactionCount.
private void addReactionCount(View v) {
if (adapter != null) {
TimelineModel timelineModel = (TimelineModel) adapter.getItem(getAdapterPosition());
if (timelineModel == null)
return;
Comment comment = timelineModel.getComment();
if (comment != null) {
boolean isReacted = reactionsCallback == null || reactionsCallback.isPreviouslyReacted(comment.getId(), v.getId());
boolean isCallingApi = reactionsCallback != null && reactionsCallback.isCallingApi(comment.getId(), v.getId());
// if (isCallingApi) return;
ReactionsModel reactionsModel = comment.getReactions() != null ? comment.getReactions() : new ReactionsModel();
switch(v.getId()) {
case R.id.heart:
case R.id.heartReaction:
reactionsModel.setHeart(!isReacted ? reactionsModel.getHeart() + 1 : reactionsModel.getHeart() - 1);
break;
case R.id.sad:
case R.id.sadReaction:
reactionsModel.setConfused(!isReacted ? reactionsModel.getConfused() + 1 : reactionsModel.getConfused() - 1);
break;
case R.id.thumbsDown:
case R.id.thumbsDownReaction:
reactionsModel.setMinusOne(!isReacted ? reactionsModel.getMinusOne() + 1 : reactionsModel.getMinusOne() - 1);
break;
case R.id.thumbsUp:
case R.id.thumbsUpReaction:
reactionsModel.setPlusOne(!isReacted ? reactionsModel.getPlusOne() + 1 : reactionsModel.getPlusOne() - 1);
break;
case R.id.laugh:
case R.id.laughReaction:
reactionsModel.setLaugh(!isReacted ? reactionsModel.getLaugh() + 1 : reactionsModel.getLaugh() - 1);
break;
case R.id.hurray:
case R.id.hurrayReaction:
reactionsModel.setHooray(!isReacted ? reactionsModel.getHooray() + 1 : reactionsModel.getHooray() - 1);
break;
}
comment.setReactions(reactionsModel);
appendEmojies(reactionsModel);
timelineModel.setComment(comment);
}
}
}
use of com.fastaccess.data.dao.model.Comment in project FastHub by k0shk0sh.
the class FeedsViewHolder method appendPullRequestReviewCommentEvent.
private void appendPullRequestReviewCommentEvent(SpannableBuilder spannableBuilder, Event eventsModel) {
PullRequest pullRequest = eventsModel.getPayload().getPullRequest();
Comment comment = eventsModel.getPayload().getComment();
spannableBuilder.bold("reviewed").append(" ").bold("pull request").append(" ").bold("in").append(" ").append(eventsModel.getRepo().getName()).bold("#").bold(String.valueOf(pullRequest.getNumber()));
if (comment.getBody() != null) {
MarkDownProvider.stripMdText(description, comment.getBody().replaceAll("\\r?\\n|\\r", " "));
description.setVisibility(View.VISIBLE);
} else {
description.setText("");
description.setVisibility(View.GONE);
}
}
use of com.fastaccess.data.dao.model.Comment in project FastHub by k0shk0sh.
the class FeedsViewHolder method appendCommitComment.
private void appendCommitComment(SpannableBuilder spannableBuilder, Event eventsModel) {
Comment comment = eventsModel.getPayload().getCommitComment() == null ? eventsModel.getPayload().getComment() : eventsModel.getPayload().getCommitComment();
String commitId = comment != null && comment.getCommitId() != null && comment.getCommitId().length() > 10 ? comment.getCommitId().substring(0, 10) : null;
spannableBuilder.bold("commented").append(" ").bold("on").append(" ").bold("commit").append(" ").append(eventsModel.getRepo().getName()).url(commitId != null ? "@" + commitId : "");
if (comment != null && comment.getBody() != null) {
MarkDownProvider.stripMdText(description, comment.getBody().replaceAll("\\r?\\n|\\r", " "));
description.setVisibility(View.VISIBLE);
} else {
description.setText("");
description.setVisibility(View.GONE);
}
}
use of com.fastaccess.data.dao.model.Comment in project FastHub by k0shk0sh.
the class FeedsViewHolder method appendIssueCommentEvent.
private void appendIssueCommentEvent(SpannableBuilder spannableBuilder, Event eventsModel) {
Comment comment = eventsModel.getPayload().getComment();
Issue issue = eventsModel.getPayload().getIssue();
spannableBuilder.bold("commented").append(" ").bold("on").append(" ").bold(issue.getPullRequest() != null ? "pull request" : "issue").append(" ").append(eventsModel.getRepo().getName()).bold("#").bold(String.valueOf(issue.getNumber()));
if (comment.getBody() != null) {
MarkDownProvider.stripMdText(description, comment.getBody().replaceAll("\\r?\\n|\\r", " "));
description.setVisibility(View.VISIBLE);
} else {
description.setText("");
description.setVisibility(View.GONE);
}
}
Aggregations