Search in sources :

Example 1 with ConsumerFavoriteVideo

use of com.zype.android.webapi.model.consumers.ConsumerFavoriteVideo 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_LIST, 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

Subscribe (com.squareup.otto.Subscribe)1 VideoParamsBuilder (com.zype.android.webapi.builder.VideoParamsBuilder)1 ConsumerFavoriteVideo (com.zype.android.webapi.model.consumers.ConsumerFavoriteVideo)1 ConsumerFavoriteVideoData (com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData)1