Search in sources :

Example 1 with PlaylistAdapter

use of org.moire.ultrasonic.view.PlaylistAdapter in project ultrasonic by ultrasonic.

the class SelectPlaylistActivity method load.

private void load() {
    BackgroundTask<List<Playlist>> task = new TabActivityBackgroundTask<List<Playlist>>(this, true) {

        @Override
        protected List<Playlist> doInBackground() throws Throwable {
            MusicService musicService = MusicServiceFactory.getMusicService(SelectPlaylistActivity.this);
            boolean refresh = getIntent().getBooleanExtra(Constants.INTENT_EXTRA_NAME_REFRESH, false);
            List<Playlist> playlists = musicService.getPlaylists(refresh, SelectPlaylistActivity.this, this);
            if (!Util.isOffline(SelectPlaylistActivity.this))
                new CacheCleaner(SelectPlaylistActivity.this, getDownloadService()).cleanPlaylists(playlists);
            return playlists;
        }

        @Override
        protected void done(List<Playlist> result) {
            playlistsListView.setAdapter(playlistAdapter = new PlaylistAdapter(SelectPlaylistActivity.this, result));
            emptyTextView.setVisibility(result.isEmpty() ? View.VISIBLE : View.GONE);
        }
    };
    task.execute();
}
Also used : Playlist(org.moire.ultrasonic.domain.Playlist) TabActivityBackgroundTask(org.moire.ultrasonic.util.TabActivityBackgroundTask) MusicService(org.moire.ultrasonic.service.MusicService) PlaylistAdapter(org.moire.ultrasonic.view.PlaylistAdapter) List(java.util.List) CacheCleaner(org.moire.ultrasonic.util.CacheCleaner)

Aggregations

List (java.util.List)1 Playlist (org.moire.ultrasonic.domain.Playlist)1 MusicService (org.moire.ultrasonic.service.MusicService)1 CacheCleaner (org.moire.ultrasonic.util.CacheCleaner)1 TabActivityBackgroundTask (org.moire.ultrasonic.util.TabActivityBackgroundTask)1 PlaylistAdapter (org.moire.ultrasonic.view.PlaylistAdapter)1