Clover Coverage Report - Subsonic-Android Coverage Report
Coverage timestamp: ven dic 19 2014 17:57:13 EST
../../../../../img/srcFileCovDistChart10.png 0% of files have more coverage
17   72   6   4,25
2   42   0,35   4
4     1,5  
1    
This report was generated with an evaluation server license. Purchase Clover or configure your license.
 
  LyricsActivity       Line # 37 17 6 91,3% 0.9130435
 
No Tests
 
1    /*
2    This file is part of Subsonic.
3   
4    Subsonic is free software: you can redistribute it and/or modify
5    it under the terms of the GNU General Public License as published by
6    the Free Software Foundation, either version 3 of the License, or
7    (at your option) any later version.
8   
9    Subsonic is distributed in the hope that it will be useful,
10    but WITHOUT ANY WARRANTY; without even the implied warranty of
11    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12    GNU General Public License for more details.
13   
14    You should have received a copy of the GNU General Public License
15    along with Subsonic. If not, see <http://www.gnu.org/licenses/>.
16   
17    Copyright 2009 (C) Sindre Mehus
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    * Displays song lyrics.
34    *
35    * @author Sindre Mehus
36    */
 
37    public final class LyricsActivity extends SubsonicTabActivity {
38   
 
39  1 toggle @Override
40    protected void onCreate(Bundle bundle) {
41  1 super.onCreate(bundle);
42  1 setContentView(R.layout.lyrics);
43  1 load();
44    }
45   
 
46  1 toggle private void load() {
47  1 BackgroundTask<Lyrics> task = new TabActivityBackgroundTask<Lyrics>(this) {
 
48  1 toggle @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   
 
56  1 toggle @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    }