use of com.fastaccess.data.dao.PayloadModel in project FastHub by k0shk0sh.
the class FeedsPresenter method onItemClick.
@Override
public void onItemClick(int position, View v, Event item) {
if (item.getType() == EventsType.ForkEvent) {
NameParser parser = new NameParser(item.getPayload().getForkee().getHtmlUrl());
RepoPagerActivity.startRepoPager(v.getContext(), parser);
} else {
PayloadModel payloadModel = item.getPayload();
if (payloadModel != null) {
if (payloadModel.getHead() != null) {
if (payloadModel.getCommits() != null && payloadModel.getCommits().size() > 1) {
sendToView(view -> view.onOpenCommitChooser(payloadModel.getCommits()));
} else {
Repo repoModel = item.getRepo();
NameParser nameParser = new NameParser(repoModel.getUrl());
Intent intent = CommitPagerActivity.createIntent(v.getContext(), nameParser.getName(), nameParser.getUsername(), payloadModel.getHead(), true, LinkParserHelper.isEnterprise(repoModel.getUrl()));
v.getContext().startActivity(intent);
}
} else if (payloadModel.getIssue() != null) {
SchemeParser.launchUri(v.getContext(), Uri.parse(payloadModel.getIssue().getHtmlUrl()), true);
} else if (payloadModel.getPullRequest() != null) {
SchemeParser.launchUri(v.getContext(), Uri.parse(payloadModel.getPullRequest().getHtmlUrl()), true);
} else if (payloadModel.getComment() != null) {
SchemeParser.launchUri(v.getContext(), Uri.parse(payloadModel.getComment().getHtmlUrl()), true);
} else if (item.getType() == EventsType.ReleaseEvent && payloadModel.getRelease() != null) {
NameParser nameParser = new NameParser(payloadModel.getRelease().getHtmlUrl());
v.getContext().startActivity(ReleasesListActivity.getIntent(v.getContext(), nameParser.getUsername(), nameParser.getName(), payloadModel.getRelease().getId(), LinkParserHelper.isEnterprise(payloadModel.getRelease().getHtmlUrl())));
} else if (item.getType() == EventsType.CreateEvent && "tag".equalsIgnoreCase(payloadModel.getRefType())) {
Repo repoModel = item.getRepo();
NameParser nameParser = new NameParser(repoModel.getUrl());
v.getContext().startActivity(ReleasesListActivity.getIntent(v.getContext(), nameParser.getUsername(), nameParser.getName(), payloadModel.getRef(), LinkParserHelper.isEnterprise(repoModel.getUrl())));
} else if (item.getType() == EventsType.GollumEvent) {
Repo repoModel = item.getRepo();
NameParser parser = new NameParser(repoModel.getUrl());
v.getContext().startActivity(WikiActivity.Companion.getWiki(v.getContext(), parser.getName(), parser.getUsername()));
} else {
Repo repoModel = item.getRepo();
NameParser parser = new NameParser(repoModel.getUrl());
RepoPagerActivity.startRepoPager(v.getContext(), parser);
}
}
}
}
use of com.fastaccess.data.dao.PayloadModel in project FastHub by k0shk0sh.
the class FeedsViewHolder method appendCreateEvent.
private void appendCreateEvent(SpannableBuilder spannableBuilder, Event eventsModel) {
PayloadModel payloadModel = eventsModel.getPayload();
String refType = payloadModel.getRefType();
spannableBuilder.bold("created").append(" ").append(refType).append(" ").append(!"repository".equalsIgnoreCase(refType) ? payloadModel.getRef() + " " : "").bold("at").append(" ").append(eventsModel.getRepo().getName());
if (payloadModel.getDescription() != null) {
MarkDownProvider.stripMdText(description, payloadModel.getDescription().replaceAll("\\r?\\n|\\r", " "));
description.setVisibility(View.VISIBLE);
} else {
description.setText("");
description.setVisibility(View.GONE);
}
}
Aggregations