1 |
|
|
2 |
|
|
3 |
|
|
4 |
|
|
5 |
|
|
6 |
|
|
7 |
|
|
8 |
|
|
9 |
|
|
10 |
|
|
11 |
|
|
12 |
|
|
13 |
|
|
14 |
|
|
15 |
|
package net.sourceforge.subsonic.androidapp.util; |
16 |
|
|
17 |
|
import android.view.View; |
18 |
|
import android.view.ViewGroup; |
19 |
|
import android.widget.BaseAdapter; |
20 |
|
import android.widget.ListView; |
21 |
|
|
22 |
|
import java.util.ArrayList; |
23 |
|
import java.util.List; |
24 |
|
|
25 |
|
|
26 |
|
|
27 |
|
|
28 |
|
|
29 |
|
|
30 |
|
|
31 |
|
|
32 |
|
|
33 |
|
|
34 |
|
|
35 |
|
|
36 |
|
|
37 |
|
|
38 |
|
|
39 |
|
|
40 |
|
|
41 |
|
|
42 |
|
|
43 |
|
|
44 |
|
|
45 |
|
|
46 |
|
|
47 |
|
|
48 |
|
|
49 |
|
|
|
|
| 54,3% |
Uncovered Elements: 16 (35) |
Complexity: 13 |
Complexity Density: 0,65 |
|
50 |
|
public class SackOfViewsAdapter extends BaseAdapter { |
51 |
|
private List<View> views = null; |
52 |
|
|
53 |
|
|
54 |
|
|
55 |
|
|
56 |
|
|
|
|
| 0% |
Uncovered Elements: 6 (6) |
Complexity: 2 |
Complexity Density: 0,5 |
|
57 |
0
|
public SackOfViewsAdapter(int count) {... |
58 |
0
|
super(); |
59 |
|
|
60 |
0
|
views = new ArrayList<View>(count); |
61 |
|
|
62 |
0
|
for (int i = 0; i < count; i++) { |
63 |
0
|
views.add(null); |
64 |
|
} |
65 |
|
} |
66 |
|
|
67 |
|
|
68 |
|
|
69 |
|
|
70 |
|
|
71 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (3) |
Complexity: 1 |
Complexity Density: 0,33 |
|
72 |
33
|
public SackOfViewsAdapter(List<View> views) {... |
73 |
33
|
for (View view : views) { |
74 |
65
|
view.setLayoutParams(new ListView.LayoutParams(ViewGroup.LayoutParams.FILL_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT)); |
75 |
|
} |
76 |
33
|
this.views = views; |
77 |
|
} |
78 |
|
|
79 |
|
|
80 |
|
|
81 |
|
|
82 |
|
|
83 |
|
@param |
84 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
85 |
0
|
@Override... |
86 |
|
public Object getItem(int position) { |
87 |
0
|
return (views.get(position)); |
88 |
|
} |
89 |
|
|
90 |
|
|
91 |
|
|
92 |
|
|
93 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
94 |
8416
|
@Override... |
95 |
|
public int getCount() { |
96 |
8416
|
return (views.size()); |
97 |
|
} |
98 |
|
|
99 |
|
|
100 |
|
|
101 |
|
|
102 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
103 |
504
|
@Override... |
104 |
|
public int getViewTypeCount() { |
105 |
504
|
return (getCount()); |
106 |
|
} |
107 |
|
|
108 |
|
|
109 |
|
|
110 |
|
|
111 |
|
|
112 |
|
@param |
113 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
114 |
326
|
@Override... |
115 |
|
public int getItemViewType(int position) { |
116 |
326
|
return (position); |
117 |
|
} |
118 |
|
|
119 |
|
|
120 |
|
|
121 |
|
|
122 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
123 |
0
|
@Override... |
124 |
|
public boolean areAllItemsEnabled() { |
125 |
0
|
return (false); |
126 |
|
} |
127 |
|
|
128 |
|
|
129 |
|
|
130 |
|
|
131 |
|
|
132 |
|
@param |
133 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
134 |
444
|
@Override... |
135 |
|
public boolean isEnabled(int position) { |
136 |
444
|
return (false); |
137 |
|
} |
138 |
|
|
139 |
|
|
140 |
|
|
141 |
|
|
142 |
|
|
143 |
|
@param |
144 |
|
@param |
145 |
|
@param |
146 |
|
|
|
|
| 57,1% |
Uncovered Elements: 3 (7) |
Complexity: 2 |
Complexity Density: 0,4 |
|
147 |
74
|
@Override... |
148 |
|
public View getView(int position, View convertView, |
149 |
|
ViewGroup parent) { |
150 |
74
|
View result = views.get(position); |
151 |
|
|
152 |
74
|
if (result == null) { |
153 |
0
|
result = newView(position, parent); |
154 |
0
|
views.set(position, result); |
155 |
|
} |
156 |
|
|
157 |
74
|
return (result); |
158 |
|
} |
159 |
|
|
160 |
|
|
161 |
|
|
162 |
|
|
163 |
|
|
164 |
|
@param |
165 |
|
|
|
|
| 100% |
Uncovered Elements: 0 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
166 |
21
|
@Override... |
167 |
|
public long getItemId(int position) { |
168 |
21
|
return (position); |
169 |
|
} |
170 |
|
|
171 |
|
|
172 |
|
|
173 |
|
|
174 |
|
|
175 |
|
@param |
176 |
|
@param |
177 |
|
|
|
|
| 0% |
Uncovered Elements: 1 (1) |
Complexity: 1 |
Complexity Density: 1 |
|
178 |
0
|
protected View newView(int position, ViewGroup parent) {... |
179 |
0
|
throw new RuntimeException("You must override newView()!"); |
180 |
|
} |
181 |
|
} |