Search in sources :

Example 1 with Lyrics

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

the class LyricsActivity method load.

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

        @Override
        protected Lyrics doInBackground() throws Throwable {
            String artist = getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_ARTIST);
            String title = getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_TITLE);
            MusicService musicService = MusicServiceFactory.getMusicService(LyricsActivity.this);
            return musicService.getLyrics(artist, title, LyricsActivity.this, this);
        }

        @Override
        protected void done(Lyrics result) {
            TextView artistView = (TextView) findViewById(R.id.lyrics_artist);
            TextView titleView = (TextView) findViewById(R.id.lyrics_title);
            TextView textView = (TextView) findViewById(R.id.lyrics_text);
            if (result != null && result.getArtist() != null) {
                artistView.setText(result.getArtist());
                titleView.setText(result.getTitle());
                textView.setText(result.getText());
            } else {
                artistView.setText(R.string.lyrics_nomatch);
            }
        }
    };
    task.execute();
}
Also used : TabActivityBackgroundTask(org.moire.ultrasonic.util.TabActivityBackgroundTask) MusicService(org.moire.ultrasonic.service.MusicService) Lyrics(org.moire.ultrasonic.domain.Lyrics) TextView(android.widget.TextView)

Aggregations

TextView (android.widget.TextView)1 Lyrics (org.moire.ultrasonic.domain.Lyrics)1 MusicService (org.moire.ultrasonic.service.MusicService)1 TabActivityBackgroundTask (org.moire.ultrasonic.util.TabActivityBackgroundTask)1