Search in sources :

Example 1 with Playlist

use of com.zype.android.webapi.model.playlist.Playlist in project zype-android by zype.

the class PlaylistActivity method handleRetrievePlaylist.

@Subscribe
public void handleRetrievePlaylist(PlaylistEvent event) {
    Logger.d("Activity handlePlaylistEvent size=" + event.getEventData().getModelData().getResponse().size());
    Playlist data = event.getEventData().getModelData();
    if (data.getResponse().size() > 0) {
        if (mPlaylistList == null) {
            mPlaylistList = new ArrayList<>();
        }
        mPlaylistList.addAll(data.getResponse());
        // with platform in case some palylists were deleted
        if (event.getEventData().getModelData().getPagination().getCurrent() == 1) {
            DataHelper.deletePlaylistsByParentId(this.getContentResolver(), parentId);
        }
        int i = DataHelper.insertPlaylists(this.getContentResolver(), data.getResponse());
        Logger.d("added " + i + " playlists");
    } else {
        mTvEmpty.setText(R.string.videos_empty);
    }
}
Also used : Playlist(com.zype.android.webapi.model.playlist.Playlist) Subscribe(com.squareup.otto.Subscribe)

Example 2 with Playlist

use of com.zype.android.webapi.model.playlist.Playlist in project zype-android by zype.

the class PlaylistFragment method handleRetrievePlaylist.

@Subscribe
public void handleRetrievePlaylist(PlaylistEvent event) {
    Logger.d("handlePlaylistEvent size=" + event.getEventData().getModelData().getResponse().size());
    Playlist data = event.getEventData().getModelData();
    if (data.getResponse().size() > 0) {
        if (mPlaylistList == null) {
            mPlaylistList = new ArrayList<>();
        }
        mPlaylistList.addAll(data.getResponse());
        // with platform in case some palylists were deleted
        if (event.getEventData().getModelData().getPagination().getCurrent() == 1) {
            DataHelper.deletePlaylistsByParentId(getActivity().getContentResolver(), parentId);
        }
        int i = DataHelper.insertPlaylists(getActivity().getContentResolver(), data.getResponse());
        Logger.d("added " + i + " playlists");
    } else {
        mTvEmpty.setText(R.string.videos_empty);
    }
}
Also used : Playlist(com.zype.android.webapi.model.playlist.Playlist) Subscribe(com.squareup.otto.Subscribe)

Aggregations

Subscribe (com.squareup.otto.Subscribe)2 Playlist (com.zype.android.webapi.model.playlist.Playlist)2