Search in sources :

Example 1 with ConsumerFavoriteVideoData

use of com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData in project zype-android by zype.

the class FavoriteHelper method objectFromCursor.

@NonNull
public static ConsumerFavoriteVideoData objectFromCursor(@NonNull Cursor cursor) {
    ConsumerFavoriteVideoData favorite = new ConsumerFavoriteVideoData();
    favorite.setId(cursor.getString(cursor.getColumnIndex(Contract.Favorite.COLUMN_ID)));
    favorite.setCreatedAt(cursor.getString(cursor.getColumnIndex(Contract.Favorite.COLUMN_CREATED_AT)));
    favorite.setConsumerId(cursor.getString(cursor.getColumnIndex(Contract.Favorite.COLUMN_CONSUMER_ID)));
    favorite.setDeletedAt(cursor.getString(cursor.getColumnIndex(Contract.Favorite.COLUMN_DELETED_AT)));
    favorite.setUpdatedAt(cursor.getString(cursor.getColumnIndex(Contract.Favorite.COLUMN_UPDATED_AT)));
    favorite.setVideoId(cursor.getString(cursor.getColumnIndex(Contract.Favorite.COLUMN_VIDEO_ID)));
    return favorite;
}
Also used : ConsumerFavoriteVideoData(com.zype.android.webapi.model.consumers.ConsumerFavoriteVideoData) NonNull(androidx.annotation.NonNull)

Example 2 with ConsumerFavoriteVideoData

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

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