Search in sources :

Example 1 with VideoEntitlements

use of com.zype.android.webapi.model.entitlements.VideoEntitlements in project zype-android by zype.

the class MyLibraryFragment method handleVideoEntitlements.

// ///////////
// Subscriptions
// 
@Subscribe
public void handleVideoEntitlements(VideoEntitlementsEvent event) {
    VideoEntitlements data = event.getEventData().getModelData();
    Logger.d("handleVideoEntitlements(): size=" + data.videoEntitlements.size());
    for (VideoEntitlementData item : data.videoEntitlements) {
        videoEntitlements.put(item.videoId, item);
    }
    if (Pagination.hasNextPage(data.pagination) && !data.videoEntitlements.isEmpty()) {
        requestVideoEntitlements(Pagination.getNextPage(data.pagination));
    } else {
        // Clear entitlement flag in all existing videos
        VideoHelper.setEntitlement(getActivity().getContentResolver(), null, false, "");
        // Load videos with entitlements
        for (String videoId : videoEntitlements.keySet()) {
            VideoParamsBuilder builder = new VideoParamsBuilder().addVideoId(videoId);
            getApi().executeRequest(WebApiManager.Request.VIDEO_LATEST_GET, builder.build());
        }
    }
}
Also used : VideoParamsBuilder(com.zype.android.webapi.builder.VideoParamsBuilder) VideoEntitlementData(com.zype.android.webapi.model.entitlements.VideoEntitlementData) VideoEntitlements(com.zype.android.webapi.model.entitlements.VideoEntitlements) Subscribe(com.squareup.otto.Subscribe)

Aggregations

Subscribe (com.squareup.otto.Subscribe)1 VideoParamsBuilder (com.zype.android.webapi.builder.VideoParamsBuilder)1 VideoEntitlementData (com.zype.android.webapi.model.entitlements.VideoEntitlementData)1 VideoEntitlements (com.zype.android.webapi.model.entitlements.VideoEntitlements)1