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