Search in sources :

Example 1 with VideoParamsBuilder

use of com.zype.android.webapi.builder.VideoParamsBuilder in project zype-android by zype.

the class TestVideo method testHighLightVideo.

@SmallTest
public void testHighLightVideo() throws Exception {
    mActivity.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            VideoParamsBuilder builder = new VideoParamsBuilder().addPage(1).addCategoryHighlight(true);
            mApi.executeRequest(WebApiManager.Request.VIDEO_LATEST_GET, builder.build());
        }
    });
    assertTrue(mLock.await(TEST_FAIL_TIME, TimeUnit.MILLISECONDS));
}
Also used : VideoParamsBuilder(com.zype.android.webapi.builder.VideoParamsBuilder) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 2 with VideoParamsBuilder

use of com.zype.android.webapi.builder.VideoParamsBuilder in project zype-android by zype.

the class TestVideo method testGetWeekVideo.

@SmallTest
public void testGetWeekVideo() throws Exception {
    mActivity.runOnUiThread(new Runnable() {

        @Override
        public void run() {
            VideoParamsBuilder builder = new VideoParamsBuilder().addDateLimit("2015-06-28", "2015-07-04").addPage(1);
            mApi.executeRequest(WebApiManager.Request.VIDEO_LATEST_GET, builder.build());
        }
    });
    assertTrue(mLock.await(TEST_FAIL_TIME, TimeUnit.MILLISECONDS));
}
Also used : VideoParamsBuilder(com.zype.android.webapi.builder.VideoParamsBuilder) SmallTest(android.test.suitebuilder.annotation.SmallTest)

Example 3 with VideoParamsBuilder

use of com.zype.android.webapi.builder.VideoParamsBuilder in project zype-android by zype.

the class VideosActivity method loadVideosFromPlaylist.

// //////////
// Data
// 
private void loadVideosFromPlaylist(int page) {
    Logger.d("load Videos from playlist");
    VideoParamsBuilder builder = new VideoParamsBuilder();
    builder.addPlaylistId(playlistId);
    builder.addPage(page);
    builder.addPerPage(ParamsBuilder.PER_PAGE_DEFAULT);
    getApi().executeRequest(WebApiManager.Request.VIDEO_FROM_PLAYLIST, builder.build());
}
Also used : VideoParamsBuilder(com.zype.android.webapi.builder.VideoParamsBuilder)

Example 4 with VideoParamsBuilder

use of com.zype.android.webapi.builder.VideoParamsBuilder 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)

Example 5 with VideoParamsBuilder

use of com.zype.android.webapi.builder.VideoParamsBuilder in project zype-android by zype.

the class FavoritesFragment method handleConsumerFavoriteVideo.

// ///////////
// Subscriptions
// 
@Subscribe
public void handleConsumerFavoriteVideo(ConsumerFavoriteVideoEvent event) {
    Logger.d("handleConsumerFavoriteVideo");
    ConsumerFavoriteVideo favorite = event.getEventData().getModelData();
    if (Pagination.hasNextPage(favorite.getPagination()) && !favorite.getResponse().isEmpty()) {
        requestConsumerFavoriteVideo(Pagination.getNextPage(favorite.getPagination()));
    }
    DataHelper.insertFavorites(getActivity().getContentResolver(), favorite.getResponse());
    // Retrieve videos
    for (ConsumerFavoriteVideoData item : favorite.getResponse()) {
        VideoParamsBuilder builder = new VideoParamsBuilder().addVideoId(item.getVideoId());
        getApi().executeRequest(WebApiManager.Request.VIDEO_LATEST_GET, builder.build());
    }
}
Also used : ConsumerFavoriteVideo(com.zype.android.webapi.model.consumers.ConsumerFavoriteVideo) VideoParamsBuilder(com.zype.android.webapi.builder.VideoParamsBuilder) ConsumerFavoriteVideoData(com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData) Subscribe(com.squareup.otto.Subscribe)

Aggregations

VideoParamsBuilder (com.zype.android.webapi.builder.VideoParamsBuilder)5 SmallTest (android.test.suitebuilder.annotation.SmallTest)2 Subscribe (com.squareup.otto.Subscribe)2 ConsumerFavoriteVideo (com.zype.android.webapi.model.consumers.ConsumerFavoriteVideo)1 ConsumerFavoriteVideoData (com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData)1 VideoEntitlementData (com.zype.android.webapi.model.entitlements.VideoEntitlementData)1 VideoEntitlements (com.zype.android.webapi.model.entitlements.VideoEntitlements)1