Search in sources :

Example 1 with Genre

use of org.moire.ultrasonic.domain.Genre in project ultrasonic by ultrasonic.

the class SelectGenreActivity method onItemClick.

@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
    Genre genre = (Genre) parent.getItemAtPosition(position);
    if (genre != null) {
        Intent intent = new Intent(this, SelectAlbumActivity.class);
        intent.putExtra(Constants.INTENT_EXTRA_NAME_GENRE_NAME, genre.getName());
        intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_SIZE, Util.getMaxSongs(this));
        intent.putExtra(Constants.INTENT_EXTRA_NAME_ALBUM_LIST_OFFSET, 0);
        startActivityForResultWithoutTransition(this, intent);
    }
}
Also used : Intent(android.content.Intent) Genre(org.moire.ultrasonic.domain.Genre)

Example 2 with Genre

use of org.moire.ultrasonic.domain.Genre 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

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