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);
}
}
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();
}
Aggregations