1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
package net.sourceforge.subsonic.androidapp.service.parser; |
20 |
|
|
21 |
|
import java.io.Reader; |
22 |
|
|
23 |
|
import org.xmlpull.v1.XmlPullParser; |
24 |
|
|
25 |
|
import android.content.Context; |
26 |
|
import net.sourceforge.subsonic.androidapp.domain.JukeboxStatus; |
27 |
|
|
28 |
|
|
29 |
|
@author |
30 |
|
|
|
|
| 70,4% |
Uncovered Elements: 8 (27) |
Complexity: 7 |
Complexity Density: 0,41 |
|
31 |
|
public class JukeboxStatusParser extends AbstractParser { |
32 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
33 |
4
|
public JukeboxStatusParser(Context context) {... |
34 |
4
|
super(context); |
35 |
|
} |
36 |
|
|
|
|
| 66,7% |
Uncovered Elements: 8 (24) |
Complexity: 6 |
Complexity Density: 0,38 |
|
37 |
4
|
public JukeboxStatus parse(Reader reader) throws Exception {... |
38 |
|
|
39 |
4
|
init(reader); |
40 |
|
|
41 |
4
|
JukeboxStatus jukeboxStatus = new JukeboxStatus(); |
42 |
4
|
int eventType; |
43 |
4
|
do { |
44 |
12
|
eventType = nextParseEvent(); |
45 |
12
|
if (eventType == XmlPullParser.START_TAG) { |
46 |
8
|
String name = getElementName(); |
47 |
8
|
if ("jukeboxPlaylist".equals(name) || "jukeboxStatus".equals(name)) { |
48 |
0
|
jukeboxStatus.setPositionSeconds(getInteger("position")); |
49 |
0
|
jukeboxStatus.setCurrentIndex(getInteger("currentIndex")); |
50 |
0
|
jukeboxStatus.setPlaying(getBoolean("playing")); |
51 |
0
|
jukeboxStatus.setGain(getFloat("gain")); |
52 |
8
|
} else if ("error".equals(name)) { |
53 |
4
|
handleError(); |
54 |
|
} |
55 |
|
} |
56 |
8
|
} while (eventType != XmlPullParser.END_DOCUMENT); |
57 |
|
|
58 |
0
|
validate(); |
59 |
|
|
60 |
0
|
return jukeboxStatus; |
61 |
|
} |
62 |
|
} |