Search in sources :

Example 1 with File

use of com.zype.android.webapi.model.player.File in project zype-android by zype.

the class VideosActivity method handleDownloadVideo.

@Subscribe
public void handleDownloadVideo(DownloadVideoEvent event) {
    Logger.d("handleDownloadVideo");
    File file = ListUtils.getStringWith(event.getEventData().getModelData().getResponse().getBody().getFiles(), "mp4");
    String url;
    if (file != null) {
        url = file.getUrl();
        String fileId = event.mFileId;
        DownloadHelper.addVideoToDownloadList(getApplicationContext(), url, fileId);
    } else {
        // throw new IllegalStateException("url is null");
        UiUtils.showErrorSnackbar(mListView, "Server has returned an empty url for video file");
        Logger.e("Server response must contains \"mp\" but server has returned:" + Logger.getObjectDump(event.getEventData().getModelData().getResponse().getBody().getFiles()));
    }
}
Also used : File(com.zype.android.webapi.model.player.File) Subscribe(com.squareup.otto.Subscribe)

Example 2 with File

use of com.zype.android.webapi.model.player.File in project zype-android by zype.

the class VideoDetailActivity method handleDownloadVideo.

@Subscribe
public void handleDownloadVideo(DownloadVideoEvent event) {
    Logger.d("handleDownloadVideo");
    File file = ListUtils.getStringWith(event.getEventData().getModelData().getResponse().getBody().getFiles(), "mp4");
    String url;
    if (file != null) {
        url = file.getUrl();
        String fileId = event.mFileId;
        DataHelper.saveVideoUrl(getContentResolver(), fileId, url);
        initTabs();
    } else {
        Logger.e("Server response must contains \"mp\" but server has returned:" + Logger.getObjectDump(event.getEventData().getModelData().getResponse().getBody().getFiles()));
    }
}
Also used : File(com.zype.android.webapi.model.player.File) Subscribe(com.squareup.otto.Subscribe)

Example 3 with File

use of com.zype.android.webapi.model.player.File in project zype-android by zype.

the class MainActivity method handleDownloadVideo.

@Subscribe
public void handleDownloadVideo(DownloadVideoEvent event) {
    Logger.d("handleDownloadVideo");
    File file = ListUtils.getStringWith(event.getEventData().getModelData().getResponse().getBody().getFiles(), "mp4");
    String url;
    if (file != null) {
        url = file.getUrl();
        String fileId = event.mFileId;
        DownloadHelper.addVideoToDownloadList(getApplicationContext(), url, fileId);
    } else {
        // throw new IllegalStateException("url is null");
        UiUtils.showErrorSnackbar(getBaseView(), "Server has returned an empty url for video file");
        Logger.e("Server response must contains \"mp\" but server has returned:" + Logger.getObjectDump(event.getEventData().getModelData().getResponse().getBody().getFiles()));
    }
}
Also used : File(com.zype.android.webapi.model.player.File) Subscribe(com.squareup.otto.Subscribe)

Example 4 with File

use of com.zype.android.webapi.model.player.File in project zype-android by zype.

the class VideoDetailActivity method handleDownloadAudio.

@Subscribe
public void handleDownloadAudio(DownloadAudioEvent event) {
    File file = ListUtils.getStringWith(event.getEventData().getModelData().getResponse().getBody().getFiles(), "m4a");
    String url;
    if (file != null) {
        url = file.getUrl();
        String fileId = event.mFileId;
        DataHelper.saveAudioUrl(getContentResolver(), fileId, url);
        initTabs();
    } else {
        Logger.e("Server response must contains \"m4a\" but server has returned:" + Logger.getObjectDump(event.getEventData().getModelData().getResponse().getBody().getFiles()));
    }
}
Also used : File(com.zype.android.webapi.model.player.File) Subscribe(com.squareup.otto.Subscribe)

Example 5 with File

use of com.zype.android.webapi.model.player.File in project zype-android by zype.

the class MainActivity method handleDownloadAudio.

@Subscribe
public void handleDownloadAudio(DownloadAudioEvent event) {
    Logger.d("handleDownloadAudio");
    File file = ListUtils.getStringWith(event.getEventData().getModelData().getResponse().getBody().getFiles(), "m4a");
    String url;
    if (file != null) {
        url = file.getUrl();
        String fileId = event.mFileId;
        DownloadHelper.addAudioToDownloadList(getApplicationContext(), url, fileId);
    } else {
        // throw new IllegalStateException("url is null");
        UiUtils.showErrorSnackbar(getBaseView(), "Server has returned an empty url for audio file");
        Logger.e("Server response must contains \"m4a\" but server has returned:" + Logger.getObjectDump(event.getEventData().getModelData().getResponse().getBody().getFiles()));
    }
}
Also used : File(com.zype.android.webapi.model.player.File) Subscribe(com.squareup.otto.Subscribe)

Aggregations

Subscribe (com.squareup.otto.Subscribe)5 File (com.zype.android.webapi.model.player.File)5