use of com.fastaccess.data.dao.types.ReactionTypes in project FastHub by k0shk0sh.
the class ReactionsProvider method isPreviouslyReacted.
public boolean isPreviouslyReacted(long idOrNumber, @IdRes int vId) {
ReactionsModel reactionsModel = getReactionsMap().get(idOrNumber);
if (reactionsModel == null || InputHelper.isEmpty(reactionsModel.getContent())) {
return false;
}
ReactionTypes type = ReactionTypes.get(vId);
return type != null && type.getContent().equals(reactionsModel.getContent());
}
use of com.fastaccess.data.dao.types.ReactionTypes in project FastHub by k0shk0sh.
the class PullRequestTimelinePresenter method onLongClick.
@Override
public void onLongClick(int groupPosition, int commentPosition, @NonNull View v, @NonNull ReviewCommentModel model) {
if (getView() == null || getView().getPullRequest() == null)
return;
PullRequest pullRequest = getView().getPullRequest();
String login = pullRequest.getLogin();
String repoId = pullRequest.getRepoId();
if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) {
ReactionTypes type = ReactionTypes.get(v.getId());
if (type != null) {
getView().showReactionsPopup(type, login, repoId, model.getId(), ReactionsProvider.REVIEW_COMMENT);
} else {
onClick(groupPosition, commentPosition, v, model);
}
}
}
use of com.fastaccess.data.dao.types.ReactionTypes in project FastHub by k0shk0sh.
the class PullRequestTimelinePresenter method onItemLongClick.
@Override
public void onItemLongClick(int position, View v, TimelineModel item) {
if (getView() == null || getView().getPullRequest() == null)
return;
if (item.getType() == TimelineModel.COMMENT || item.getType() == TimelineModel.HEADER) {
if (v.getId() == R.id.commentMenu && item.getType() == TimelineModel.COMMENT) {
Comment comment = item.getComment();
if (getView() != null)
getView().onReply(comment.getUser(), comment.getBody());
} else {
PullRequest pullRequest = getView().getPullRequest();
String login = pullRequest.getLogin();
String repoId = pullRequest.getRepoId();
if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) {
ReactionTypes type = ReactionTypes.get(v.getId());
if (type != null) {
if (item.getType() == TimelineModel.HEADER) {
getView().showReactionsPopup(type, login, repoId, item.getPullRequest().getNumber(), ReactionsProvider.HEADER);
} else {
getView().showReactionsPopup(type, login, repoId, item.getComment().getId(), ReactionsProvider.COMMENT);
}
} else {
onItemClick(position, v, item);
}
}
}
} else {
onItemClick(position, v, item);
}
}
use of com.fastaccess.data.dao.types.ReactionTypes in project FastHub by k0shk0sh.
the class IssueTimelinePresenter method onItemLongClick.
@Override
public void onItemLongClick(int position, View v, TimelineModel item) {
if (getView() == null)
return;
if (item.getType() == TimelineModel.COMMENT || item.getType() == TimelineModel.HEADER) {
if (v.getId() == R.id.commentMenu && item.getType() == TimelineModel.COMMENT) {
Comment comment = item.getComment();
if (getView() != null)
getView().onReply(comment.getUser(), comment.getBody());
} else {
if (getView().getIssue() == null)
return;
Issue issue = getView().getIssue();
String login = issue.getLogin();
String repoId = issue.getRepoId();
if (!InputHelper.isEmpty(login) && !InputHelper.isEmpty(repoId)) {
ReactionTypes type = ReactionTypes.get(v.getId());
if (type != null) {
if (item.getType() == TimelineModel.HEADER) {
getView().showReactionsPopup(type, login, repoId, item.getIssue().getNumber(), true);
} else {
getView().showReactionsPopup(type, login, repoId, item.getComment().getId(), false);
}
} else {
onItemClick(position, v, item);
}
}
}
} else {
onItemClick(position, v, item);
}
}
use of com.fastaccess.data.dao.types.ReactionTypes in project FastHub by k0shk0sh.
the class ReactionService method onHandleIntent.
@Override
protected void onHandleIntent(@Nullable Intent intent) {
if (intent != null && intent.getExtras() != null) {
Bundle bundle = intent.getExtras();
ReactionTypes reactionType = (ReactionTypes) bundle.getSerializable(BundleConstant.EXTRA_TYPE);
boolean isCommit = bundle.getBoolean(BundleConstant.EXTRA);
String login = bundle.getString(BundleConstant.EXTRA_TWO);
String repo = bundle.getString(BundleConstant.EXTRA_THREE);
long commentId = bundle.getLong(BundleConstant.ID);
boolean isEnterprise = bundle.getBoolean(BundleConstant.IS_ENTERPRISE);
if (InputHelper.isEmpty(login) || InputHelper.isEmpty(repo) || reactionType == null) {
stopSelf();
return;
}
if (isCommit) {
postCommit(reactionType, login, repo, commentId, isEnterprise);
} else {
post(reactionType, login, repo, commentId, isEnterprise);
}
}
}
Aggregations