Search in sources :

Example 1 with GenreAdapter

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

the class SelectGenreActivity method load.

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

        @Override
        protected List<Genre> doInBackground() throws Throwable {
            MusicService musicService = MusicServiceFactory.getMusicService(SelectGenreActivity.this);
            List<Genre> genres = new ArrayList<Genre>();
            try {
                genres = musicService.getGenres(SelectGenreActivity.this, this);
            } catch (Exception x) {
                Log.e(TAG, "Failed to load genres", x);
            }
            return genres;
        }

        @Override
        protected void done(List<Genre> result) {
            emptyView.setVisibility(result == null || result.isEmpty() ? View.VISIBLE : View.GONE);
            if (result != null) {
                genreListView.setAdapter(new GenreAdapter(SelectGenreActivity.this, result));
            }
        }
    };
    task.execute();
}
Also used : TabActivityBackgroundTask(org.moire.ultrasonic.util.TabActivityBackgroundTask) MusicService(org.moire.ultrasonic.service.MusicService) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) Genre(org.moire.ultrasonic.domain.Genre) GenreAdapter(org.moire.ultrasonic.view.GenreAdapter)

Aggregations

ArrayList (java.util.ArrayList)1 List (java.util.List)1 Genre (org.moire.ultrasonic.domain.Genre)1 MusicService (org.moire.ultrasonic.service.MusicService)1 TabActivityBackgroundTask (org.moire.ultrasonic.util.TabActivityBackgroundTask)1 GenreAdapter (org.moire.ultrasonic.view.GenreAdapter)1