Search in sources :

Example 56 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class VideosActivity method handleError.

@Subscribe
public void handleError(ErrorEvent event) {
    Logger.e("handleError()");
    if (event.getEventData() == WebApiManager.Request.CHECK_VIDEO_ENTITLEMENT) {
        RetrofitError error = event.getError();
        if (error != null) {
            VideoEntitlement response = (VideoEntitlement) event.getError().getBodyAs(VideoEntitlement.class);
            DialogHelper.showEntitlementAlert(this, response.message);
        }
    }
}
Also used : VideoEntitlement(com.zype.android.webapi.model.entitlements.VideoEntitlement) RetrofitError(retrofit.RetrofitError) Subscribe(com.squareup.otto.Subscribe)

Example 57 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class VideoDetailActivity method handleDownloadAudio.

@Subscribe
public void handleDownloadAudio(DownloadAudioEvent event) {
    File fileM4A = ListUtils.getFileByType(event.getEventData().getModelData().getResponse().getBody().getFiles(), "m4a");
    File fileMP3 = ListUtils.getFileByType(event.getEventData().getModelData().getResponse().getBody().getFiles(), "mp3");
    File file = null;
    if (fileM4A != null)
        file = fileM4A;
    else if (fileMP3 != null)
        file = fileMP3;
    String url;
    if (file != null) {
        url = file.getUrl();
        String fileId = event.mFileId;
        DataHelper.saveAudioUrl(getContentResolver(), fileId, url);
        initUI();
    } else {
        Logger.e("Server response must contains \"m4a\" or mp3 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 58 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class VideoLiveData method handleVideo.

@Subscribe
public void handleVideo(VideoEvent event) {
    Logger.d("handleVideo()");
    VideoData data = event.getEventData().getModelData().getVideoData();
    Video video = DbHelper.videoDataToVideoEntity(data);
    if (checkOnAir) {
        if ((getValue() == null || getValue().onAir == 0) && video.onAir == 1) {
            setValue(video);
        } else {
            if (getValue() != null) {
                Logger.d("handleVideo(): videoId=" + video.id + ", onAir=" + getValue().onAir);
            }
        }
    } else {
        setValue(video);
    }
}
Also used : Video(com.zype.android.Db.Entity.Video) VideoData(com.zype.android.webapi.model.video.VideoData) Subscribe(com.squareup.otto.Subscribe)

Example 59 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class SearchActivity method handleConsumer.

@Subscribe
public void handleConsumer(ConsumerEvent event) {
    Logger.d("handleConsumer");
    Consumer data = event.getEventData().getModelData();
    int subscriptionCount = data.getConsumerData().getSubscriptionCount();
    SettingsProvider.getInstance().saveSubscriptionCount(subscriptionCount);
}
Also used : Consumer(com.zype.android.webapi.model.consumers.Consumer) Subscribe(com.squareup.otto.Subscribe)

Example 60 with Subscribe

use of com.squareup.otto.Subscribe in project zype-android by zype.

the class TermsActivity method handleContentSettingsEvent.

@Subscribe
public void handleContentSettingsEvent(ContentSettingsEvent event) {
    Logger.d("handleContentSettingsEvent()");
    List<ContentSettingsData> data = event.getEventData().getModelData().getData();
    for (ContentSettingsData item : data) {
        if (item.getFriendlyTitle().equals("privacy_policy")) {
            ((WebView) findViewById(R.id.terms_webview)).loadData(item.getDescription(), "text/html", "UTF-8");
            return;
        }
    }
}
Also used : WebView(android.webkit.WebView) ContentSettingsData(com.zype.android.webapi.model.settings.ContentSettingsData) Subscribe(com.squareup.otto.Subscribe)

Aggregations

Subscribe (com.squareup.otto.Subscribe)86 Test (org.junit.Test)28 AtomicBoolean (java.util.concurrent.atomic.AtomicBoolean)27 RawTodoList (com.armueller.fluxytodo.data.RawTodoList)13 ArrayList (java.util.ArrayList)12 TodoAction (com.armueller.fluxytodo.actions.TodoAction)9 VideoData (com.zype.android.webapi.model.video.VideoData)8 DataBundle (com.armueller.fluxytodo.actions.DataBundle)7 File (com.zype.android.webapi.model.player.File)7 Intent (android.content.Intent)6 FilteredTodoList (com.armueller.fluxytodo.data.FilteredTodoList)6 ConsumerFavoriteVideoData (com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData)6 Bundle (android.os.Bundle)5 Video (com.zype.android.Db.Entity.Video)5 Consumer (com.zype.android.webapi.model.consumers.Consumer)5 IOException (java.io.IOException)5 Context (android.content.Context)4 ConnectivityManager (android.net.ConnectivityManager)4 NetworkInfo (android.net.NetworkInfo)4 Dialog (android.app.Dialog)3