use of com.fastaccess.data.dao.SimpleUrlsModel in project FastHub by k0shk0sh.
the class RepoReleasesFragment method onDownload.
@Override
public void onDownload(@NonNull Release item) {
ArrayList<SimpleUrlsModel> models = new ArrayList<>();
if (!InputHelper.isEmpty(item.getZipBallUrl())) {
String url = item.getZipBallUrl();
if (!url.endsWith(".tar.gz")) {
url = url + ".tar.gz";
}
models.add(new SimpleUrlsModel(getString(R.string.download_as_zip), url));
}
if (!InputHelper.isEmpty(item.getTarballUrl())) {
models.add(new SimpleUrlsModel(getString(R.string.download_as_tar), item.getTarballUrl()));
}
if (item.getAssets() != null && !item.getAssets().isEmpty()) {
ArrayList<SimpleUrlsModel> mapped = Stream.of(item.getAssets()).filter(value -> value != null && value.getBrowserDownloadUrl() != null).map(assetsModel -> new SimpleUrlsModel(String.format("%s (%s)", assetsModel.getName(), assetsModel.getDownloadCount()), assetsModel.getBrowserDownloadUrl())).collect(Collectors.toCollection(ArrayList::new));
if (mapped != null && !mapped.isEmpty()) {
models.addAll(mapped);
}
}
ListDialogView<SimpleUrlsModel> dialogView = new ListDialogView<>();
dialogView.initArguments(getString(R.string.releases), models);
dialogView.show(getChildFragmentManager(), "ListDialogView");
}
use of com.fastaccess.data.dao.SimpleUrlsModel in project FastHub by k0shk0sh.
the class FeedsPresenter method onItemLongClick.
@Override
public void onItemLongClick(int position, View v, Event item) {
if (item.getType() == EventsType.ForkEvent) {
if (getView() != null) {
getView().onOpenRepoChooser(Stream.of(new SimpleUrlsModel(item.getRepo().getName(), item.getRepo().getUrl()), new SimpleUrlsModel(item.getPayload().getForkee().getFullName(), item.getPayload().getForkee().getHtmlUrl())).collect(Collectors.toCollection(ArrayList::new)));
}
} else {
Repo repo = item.getRepo();
if (repo != null) {
NameParser parser = new NameParser(repo.getUrl());
RepoPagerActivity.startRepoPager(v.getContext(), parser);
}
}
}
Aggregations