Search in sources :

Example 1 with PlaylistVideo

use of com.zype.android.Db.Entity.PlaylistVideo in project zype-android by zype.

the class DbHelper method videoDataToPlaylistVideoEntity.

public static List<PlaylistVideo> videoDataToPlaylistVideoEntity(List<VideoData> videoData, String playlistId) {
    List<PlaylistVideo> result = new ArrayList<>(videoData.size());
    int number = 1;
    for (VideoData item : videoData) {
        PlaylistVideo entity = new PlaylistVideo();
        entity.number = number;
        entity.playlistId = playlistId;
        entity.videoId = item.getId();
        result.add(entity);
        number++;
    }
    return result;
}
Also used : PlaylistVideo(com.zype.android.Db.Entity.PlaylistVideo) ArrayList(java.util.ArrayList) VideoData(com.zype.android.webapi.model.video.VideoData)

Example 2 with PlaylistVideo

use of com.zype.android.Db.Entity.PlaylistVideo in project zype-android by zype.

the class DataRepository method insertPlaylistVideos.

public void insertPlaylistVideos(List<Video> videos, Playlist playlist) {
    List<PlaylistVideo> playlistVideos = new ArrayList<>();
    int number = db.zypeDao().getPlaylistVideosSync(playlist.id).size() + 1;
    for (Video video : videos) {
        PlaylistVideo playlistVideo = new PlaylistVideo();
        playlistVideo.number = number;
        playlistVideo.playlistId = playlist.id;
        playlistVideo.videoId = video.id;
        playlistVideos.add(playlistVideo);
        number++;
    }
    db.zypeDao().insertPlaylistVideos(playlistVideos);
}
Also used : PlaylistVideo(com.zype.android.Db.Entity.PlaylistVideo) PlaylistVideo(com.zype.android.Db.Entity.PlaylistVideo) Video(com.zype.android.Db.Entity.Video) FavoriteVideo(com.zype.android.Db.Entity.FavoriteVideo) ArrayList(java.util.ArrayList)

Example 3 with PlaylistVideo

use of com.zype.android.Db.Entity.PlaylistVideo in project zype-android by zype.

the class DbHelper method videosToPlaylistVideos.

public static List<PlaylistVideo> videosToPlaylistVideos(List<Video> videos, String playlistId) {
    List<PlaylistVideo> result = new ArrayList<>(videos.size());
    int number = 1;
    for (Video item : videos) {
        PlaylistVideo entity = new PlaylistVideo();
        entity.number = number;
        entity.playlistId = playlistId;
        entity.videoId = item.id;
        result.add(entity);
        number++;
    }
    return result;
}
Also used : PlaylistVideo(com.zype.android.Db.Entity.PlaylistVideo) PlaylistVideo(com.zype.android.Db.Entity.PlaylistVideo) Video(com.zype.android.Db.Entity.Video) ArrayList(java.util.ArrayList)

Aggregations

PlaylistVideo (com.zype.android.Db.Entity.PlaylistVideo)3 ArrayList (java.util.ArrayList)3 Video (com.zype.android.Db.Entity.Video)2 FavoriteVideo (com.zype.android.Db.Entity.FavoriteVideo)1 VideoData (com.zype.android.webapi.model.video.VideoData)1