Search in sources :

Example 1 with Release

use of com.fastaccess.data.dao.model.Release 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");
}
Also used : Bundle(android.os.Bundle) Stream(com.annimon.stream.Stream) ActivityHelper(com.fastaccess.helper.ActivityHelper) InputHelper(com.fastaccess.helper.InputHelper) StringRes(android.support.annotation.StringRes) NonNull(android.support.annotation.NonNull) SimpleUrlsModel(com.fastaccess.data.dao.SimpleUrlsModel) ArrayList(java.util.ArrayList) BindView(butterknife.BindView) StateLayout(com.fastaccess.ui.widgets.StateLayout) Bundler(com.fastaccess.helper.Bundler) OnLoadMore(com.fastaccess.provider.rest.loadmore.OnLoadMore) ReleasesAdapter(com.fastaccess.ui.adapter.ReleasesAdapter) View(android.view.View) ListDialogView(com.fastaccess.ui.widgets.dialog.ListDialogView) SwipeRefreshLayout(android.support.v4.widget.SwipeRefreshLayout) BundleConstant(com.fastaccess.helper.BundleConstant) DynamicRecyclerView(com.fastaccess.ui.widgets.recyclerview.DynamicRecyclerView) RestProvider(com.fastaccess.provider.rest.RestProvider) Collectors(com.annimon.stream.Collectors) MessageDialogView(com.fastaccess.ui.widgets.dialog.MessageDialogView) RecyclerViewFastScroller(com.fastaccess.ui.widgets.recyclerview.scroll.RecyclerViewFastScroller) List(java.util.List) R(com.fastaccess.R) Release(com.fastaccess.data.dao.model.Release) BaseFragment(com.fastaccess.ui.base.BaseFragment) Nullable(android.support.annotation.Nullable) SimpleUrlsModel(com.fastaccess.data.dao.SimpleUrlsModel) ListDialogView(com.fastaccess.ui.widgets.dialog.ListDialogView) ArrayList(java.util.ArrayList)

Example 2 with Release

use of com.fastaccess.data.dao.model.Release in project FastHub by k0shk0sh.

the class FeedsViewHolder method appendReleaseEvent.

private void appendReleaseEvent(SpannableBuilder spannableBuilder, Event eventsModel) {
    Release release = eventsModel.getPayload().getRelease();
    spannableBuilder.bold("released").append(" ").append(release.getName()).append(" ").append(eventsModel.getRepo().getName());
}
Also used : Release(com.fastaccess.data.dao.model.Release)

Aggregations

Release (com.fastaccess.data.dao.model.Release)2 Bundle (android.os.Bundle)1 NonNull (android.support.annotation.NonNull)1 Nullable (android.support.annotation.Nullable)1 StringRes (android.support.annotation.StringRes)1 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)1 View (android.view.View)1 BindView (butterknife.BindView)1 Collectors (com.annimon.stream.Collectors)1 Stream (com.annimon.stream.Stream)1 R (com.fastaccess.R)1 SimpleUrlsModel (com.fastaccess.data.dao.SimpleUrlsModel)1 ActivityHelper (com.fastaccess.helper.ActivityHelper)1 BundleConstant (com.fastaccess.helper.BundleConstant)1 Bundler (com.fastaccess.helper.Bundler)1 InputHelper (com.fastaccess.helper.InputHelper)1 RestProvider (com.fastaccess.provider.rest.RestProvider)1 OnLoadMore (com.fastaccess.provider.rest.loadmore.OnLoadMore)1 ReleasesAdapter (com.fastaccess.ui.adapter.ReleasesAdapter)1 BaseFragment (com.fastaccess.ui.base.BaseFragment)1