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();
}
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()));
}
}
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);
}
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);
}
}
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;
}
Aggregations