Search in sources :

Example 1 with Torrent

use of butter.droid.provider.base.model.Torrent in project butter-android by butterproject.

the class TVShowDetailsFragment method pickTorrent.

@Override
public void pickTorrent(final Episode episode, final Torrent[] torrents) {
    ArrayList<String> choices = new ArrayList<>(torrents.length);
    for (final Torrent torrent : torrents) {
        choices.add(mediaDisplayManager.getFormatDisplayName(torrent.getFormat()));
    }
    new AlertDialog.Builder(getActivity()).setTitle(getString(R.string.choose_quality)).setSingleChoiceItems(choices.toArray(new CharSequence[choices.size()]), 0, (dialog, which) -> {
        presenter.torrentSelected(episode, torrents[which]);
        dialog.dismiss();
    }).show();
}
Also used : AlertDialog(android.app.AlertDialog) MediaDisplayManager(butter.droid.base.manager.internal.media.MediaDisplayManager) Context(android.content.Context) ListRow(android.support.v17.leanback.widget.ListRow) Bundle(android.os.Bundle) HeaderItem(android.support.v17.leanback.widget.HeaderItem) ClassPresenterSelector(android.support.v17.leanback.widget.ClassPresenterSelector) AndroidSupportInjection(dagger.android.support.AndroidSupportInjection) Fragment(android.support.v4.app.Fragment) ArrayObjectAdapter(android.support.v17.leanback.widget.ArrayObjectAdapter) StreamInfo(butter.droid.base.providers.media.model.StreamInfo) Torrent(butter.droid.provider.base.model.Torrent) Season(butter.droid.provider.base.model.Season) TVBaseDetailsFragment(butter.droid.tv.ui.detail.base.TVBaseDetailsFragment) ArrayList(java.util.ArrayList) AlertDialog(android.app.AlertDialog) Inject(javax.inject.Inject) EpisodeCardPresenter(butter.droid.tv.ui.detail.show.presenter.EpisodeCardPresenter) Episode(butter.droid.provider.base.model.Episode) TVStreamLoadingActivity(butter.droid.tv.ui.loading.TVStreamLoadingActivity) DetailsOverviewRow(android.support.v17.leanback.widget.DetailsOverviewRow) R(butter.droid.tv.R) MediaWrapper(butter.droid.base.providers.media.model.MediaWrapper) Torrent(butter.droid.provider.base.model.Torrent) ArrayList(java.util.ArrayList)

Example 2 with Torrent

use of butter.droid.provider.base.model.Torrent in project butter-android by butterproject.

the class TVStreamableDetailsPresenterImpl method actionClicked.

@Override
public void actionClicked(final long actionId) {
    Movie movie = (Movie) item.getMedia();
    if (actionId == ACTION_TRAILER) {
        view.startTrailer(item, movie.getTrailer());
    } else {
        Torrent torrent = movie.getTorrents()[(int) actionId];
        view.startMovie(item, torrent, mediaDisplayManager.getFormatDisplayName(torrent.getFormat()));
    }
}
Also used : Movie(butter.droid.provider.base.model.Movie) Torrent(butter.droid.provider.base.model.Torrent)

Example 3 with Torrent

use of butter.droid.provider.base.model.Torrent in project butter-android by butterproject.

the class StreamableDetailPresenterImpl method selectQuality.

@Override
public void selectQuality(int position) {
    Torrent torrent = ((Streamable) mediaWrapper.getMedia()).getTorrents()[position];
    parentPresenter.selectTorrent(torrent);
    view.renderHealth(torrent);
    view.updateMagnet(torrent);
}
Also used : Torrent(butter.droid.provider.base.model.Torrent)

Example 4 with Torrent

use of butter.droid.provider.base.model.Torrent in project butter-android by butterproject.

the class TVStreamableDetailsPresenterImpl method addActions.

private void addActions(Movie item) {
    if (!StringUtils.isEmpty(item.getTrailer())) {
        view.addAction(ACTION_TRAILER, R.string.watch, R.string.trailer);
    }
    Torrent[] torrents = item.getTorrents();
    for (int i = 0; i < torrents.length; i++) {
        Torrent torrent = torrents[i];
        String text = mediaDisplayManager.getFormatDisplayName(torrent.getFormat());
        view.addAction(i, R.string.watch, text);
    }
}
Also used : Torrent(butter.droid.provider.base.model.Torrent)

Example 5 with Torrent

use of butter.droid.provider.base.model.Torrent in project butter-android by butterproject.

the class MockMediaProvider method mapEpisodes.

private Episode[] mapEpisodes(MockEpisode[] mockEpisodes) {
    Episode[] episodes = new Episode[mockEpisodes.length];
    for (int i = 0; i < mockEpisodes.length; i++) {
        MockEpisode episode = mockEpisodes[i];
        episodes[i] = new Episode(String.valueOf(episode.getId()), episode.getTitle(), episode.getYear(), new Genre[0], -1, episode.getPoster(), episode.getBackdrop(), episode.getSynopsis(), new Torrent[] { new Torrent(episode.getTorrent(), new Format(episode.getQuality(), Format.FORMAT_NORMAL), 0) }, episode.getEpisdoe());
    }
    return episodes;
}
Also used : MockEpisode(butter.droid.provider.mock.model.MockEpisode) Episode(butter.droid.provider.base.model.Episode) MockEpisode(butter.droid.provider.mock.model.MockEpisode) Torrent(butter.droid.provider.base.model.Torrent) Format(butter.droid.provider.base.model.Format) Genre(butter.droid.provider.base.filter.Genre)

Aggregations

Torrent (butter.droid.provider.base.model.Torrent)6 Episode (butter.droid.provider.base.model.Episode)2 Movie (butter.droid.provider.base.model.Movie)2 AlertDialog (android.app.AlertDialog)1 Context (android.content.Context)1 Bundle (android.os.Bundle)1 ArrayObjectAdapter (android.support.v17.leanback.widget.ArrayObjectAdapter)1 ClassPresenterSelector (android.support.v17.leanback.widget.ClassPresenterSelector)1 DetailsOverviewRow (android.support.v17.leanback.widget.DetailsOverviewRow)1 HeaderItem (android.support.v17.leanback.widget.HeaderItem)1 ListRow (android.support.v17.leanback.widget.ListRow)1 Fragment (android.support.v4.app.Fragment)1 MediaDisplayManager (butter.droid.base.manager.internal.media.MediaDisplayManager)1 MediaWrapper (butter.droid.base.providers.media.model.MediaWrapper)1 StreamInfo (butter.droid.base.providers.media.model.StreamInfo)1 TorrentHealth (butter.droid.base.torrent.TorrentHealth)1 Genre (butter.droid.provider.base.filter.Genre)1 Format (butter.droid.provider.base.model.Format)1 Season (butter.droid.provider.base.model.Season)1 MockEpisode (butter.droid.provider.mock.model.MockEpisode)1