1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
|
16 |
|
|
17 |
|
|
18 |
|
|
19 |
|
package net.sourceforge.subsonic.androidapp.util; |
20 |
|
|
21 |
|
import java.util.List; |
22 |
|
|
23 |
|
import android.view.View; |
24 |
|
import android.view.ViewGroup; |
25 |
|
import android.widget.ArrayAdapter; |
26 |
|
import net.sourceforge.subsonic.androidapp.activity.SubsonicTabActivity; |
27 |
|
import net.sourceforge.subsonic.androidapp.domain.MusicDirectory; |
28 |
|
|
29 |
|
|
30 |
|
@author |
31 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (22) |
Complexity: 5 |
Complexity Density: 0,31 |
|
32 |
|
public class EntryAdapter extends ArrayAdapter<MusicDirectory.Entry> { |
33 |
|
|
34 |
|
private final SubsonicTabActivity activity; |
35 |
|
private final ImageLoader imageLoader; |
36 |
|
private final boolean checkable; |
37 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (4) |
Complexity: 1 |
Complexity Density: 0,25 |
|
38 |
12
|
public EntryAdapter(SubsonicTabActivity activity, ImageLoader imageLoader, List<MusicDirectory.Entry> entries, boolean checkable) {... |
39 |
12
|
super(activity, android.R.layout.simple_list_item_1, entries); |
40 |
12
|
this.activity = activity; |
41 |
12
|
this.imageLoader = imageLoader; |
42 |
12
|
this.checkable = checkable; |
43 |
|
} |
44 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (16) |
Complexity: 4 |
Complexity Density: 0,33 |
|
45 |
157
|
@Override... |
46 |
|
public View getView(int position, View convertView, ViewGroup parent) { |
47 |
157
|
MusicDirectory.Entry entry = getItem(position); |
48 |
|
|
49 |
157
|
if (entry.isDirectory()) { |
50 |
30
|
AlbumView view; |
51 |
|
|
52 |
|
|
53 |
|
|
54 |
|
|
55 |
30
|
view = new AlbumView(activity); |
56 |
|
|
57 |
30
|
view.setAlbum(entry, imageLoader); |
58 |
30
|
return view; |
59 |
|
|
60 |
|
} else { |
61 |
127
|
SongView view; |
62 |
127
|
if (convertView != null && convertView instanceof SongView) { |
63 |
82
|
view = (SongView) convertView; |
64 |
|
} else { |
65 |
45
|
view = new SongView(activity); |
66 |
|
} |
67 |
127
|
view.setSong(entry, checkable); |
68 |
127
|
return view; |
69 |
|
} |
70 |
|
} |
71 |
|
} |