1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
|
20 |
|
package net.sourceforge.subsonic.androidapp.activity; |
21 |
|
|
22 |
|
import android.os.Bundle; |
23 |
|
import android.widget.TextView; |
24 |
|
import net.sourceforge.subsonic.androidapp.R; |
25 |
|
import net.sourceforge.subsonic.androidapp.domain.Lyrics; |
26 |
|
import net.sourceforge.subsonic.androidapp.service.MusicService; |
27 |
|
import net.sourceforge.subsonic.androidapp.service.MusicServiceFactory; |
28 |
|
import net.sourceforge.subsonic.androidapp.util.BackgroundTask; |
29 |
|
import net.sourceforge.subsonic.androidapp.util.Constants; |
30 |
|
import net.sourceforge.subsonic.androidapp.util.TabActivityBackgroundTask; |
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
@author |
36 |
|
|
|
|
| 91,3% |
Uncovered Elements: 2 (23) |
Complexity: 6 |
Complexity Density: 0,35 |
|
37 |
|
public final class LyricsActivity extends SubsonicTabActivity { |
38 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
|
39 |
1
|
@Override... |
40 |
|
protected void onCreate(Bundle bundle) { |
41 |
1
|
super.onCreate(bundle); |
42 |
1
|
setContentView(R.layout.lyrics); |
43 |
1
|
load(); |
44 |
|
} |
45 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (2) |
Complexity: 1 |
Complexity Density: 0,5 |
|
46 |
1
|
private void load() {... |
47 |
1
|
BackgroundTask<Lyrics> task = new TabActivityBackgroundTask<Lyrics>(this) { |
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
48 |
1
|
@Override... |
49 |
|
protected Lyrics doInBackground() throws Throwable { |
50 |
1
|
String artist = getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_ARTIST); |
51 |
1
|
String title = getIntent().getStringExtra(Constants.INTENT_EXTRA_NAME_TITLE); |
52 |
1
|
MusicService musicService = MusicServiceFactory.getMusicService(LyricsActivity.this); |
53 |
1
|
return musicService.getLyrics(artist, title, LyricsActivity.this, this); |
54 |
|
} |
55 |
|
|
|
|
| 80% |
Uncovered Elements: 2 (10) |
Complexity: 3 |
Complexity Density: 0,38 |
|
56 |
1
|
@Override... |
57 |
|
protected void done(Lyrics result) { |
58 |
1
|
TextView artistView = (TextView) findViewById(R.id.lyrics_artist); |
59 |
1
|
TextView titleView = (TextView) findViewById(R.id.lyrics_title); |
60 |
1
|
TextView textView = (TextView) findViewById(R.id.lyrics_text); |
61 |
1
|
if (result != null && result.getArtist() != null) { |
62 |
1
|
artistView.setText(result.getArtist()); |
63 |
1
|
titleView.setText(result.getTitle()); |
64 |
1
|
textView.setText(result.getText()); |
65 |
|
} else { |
66 |
0
|
artistView.setText(R.string.lyrics_nomatch); |
67 |
|
} |
68 |
|
} |
69 |
|
}; |
70 |
1
|
task.execute(); |
71 |
|
} |
72 |
|
} |