Search in sources :

Example 1 with TorrentHealth

use of butter.droid.base.torrent.TorrentHealth in project butter-android by butterproject.

the class MediaDetailPresenterImpl method healthClicked.

@Override
public void healthClicked() {
    Torrent torrent;
    if (selectedTorrent != null) {
        torrent = selectedTorrent;
    } else {
        Movie movie = (Movie) this.media.getMedia();
        torrent = movie.getTorrents()[0];
    }
    int seeds = torrent.getSeeds();
    int peers = torrent.getPeers();
    TorrentHealth health = TorrentHealth.calculate(seeds, peers);
    view.displayHealthInfo(health, seeds, peers);
}
Also used : Torrent(butter.droid.provider.base.model.Torrent) Movie(butter.droid.provider.base.model.Movie) TorrentHealth(butter.droid.base.torrent.TorrentHealth)

Example 2 with TorrentHealth

use of butter.droid.base.torrent.TorrentHealth in project butter-android by butterproject.

the class StreamableDetailFragment method renderHealth.

@Override
public void renderHealth(Torrent torrent) {
    int seeds = torrent.getSeeds();
    int peers = torrent.getPeers();
    if (seeds >= 0 && peers >= 0) {
        TorrentHealth health = TorrentHealth.calculate(seeds, peers);
        this.health.setImageResource(health.getImageResource());
        this.health.setVisibility(View.VISIBLE);
    } else {
        health.setVisibility(View.GONE);
    }
}
Also used : TorrentHealth(butter.droid.base.torrent.TorrentHealth)

Aggregations

TorrentHealth (butter.droid.base.torrent.TorrentHealth)2 Movie (butter.droid.provider.base.model.Movie)1 Torrent (butter.droid.provider.base.model.Torrent)1