155 new Thread(this).start(); |
155 new Thread(this).start(); |
156 } |
156 } |
157 |
157 |
158 public void run(){ |
158 public void run(){ |
159 final ArrayList<HashMap<String, ?>> gravesDataNew = FrontendDataUtils.getGraves(this); |
159 final ArrayList<HashMap<String, ?>> gravesDataNew = FrontendDataUtils.getGraves(this); |
160 final ArrayList<HashMap<String, ?>> flagsDataNew = FrontendDataUtils.getFlags(this); |
|
161 final ArrayList<HashMap<String, ?>> typesDataNew = FrontendDataUtils.getTypes(this); |
|
162 final ArrayList<HashMap<String, ?>> hatsDataNew = FrontendDataUtils.getHats(this); |
|
163 final ArrayList<String> voicesDataNew = FrontendDataUtils.getVoices(this); |
|
164 final ArrayList<String> fortsDataNew = FrontendDataUtils.getForts(this); |
|
165 |
|
166 |
|
167 this.runOnUiThread(new Runnable(){ |
160 this.runOnUiThread(new Runnable(){ |
168 public void run() { |
161 public void run() { |
169 copy(gravesData, gravesDataNew); |
162 copy(gravesData, gravesDataNew); |
170 ((SimpleAdapter)grave.getAdapter()).notifyDataSetChanged(); |
163 ((SimpleAdapter)grave.getAdapter()).notifyDataSetChanged(); |
171 |
164 } |
|
165 }); |
|
166 |
|
167 final ArrayList<HashMap<String, ?>> flagsDataNew = FrontendDataUtils.getFlags(this); |
|
168 this.runOnUiThread(new Runnable(){ |
|
169 public void run() { |
172 copy(flagsData, flagsDataNew); |
170 copy(flagsData, flagsDataNew); |
173 ((SimpleAdapter)flag.getAdapter()).notifyDataSetChanged(); |
171 ((SimpleAdapter)flag.getAdapter()).notifyDataSetChanged(); |
174 |
172 } |
|
173 }); |
|
174 |
|
175 final ArrayList<HashMap<String, ?>> typesDataNew = FrontendDataUtils.getTypes(this); |
|
176 this.runOnUiThread(new Runnable(){ |
|
177 public void run() { |
175 copy(typesData, typesDataNew); |
178 copy(typesData, typesDataNew); |
176 ((SimpleAdapter)difficulty.getAdapter()).notifyDataSetChanged(); |
179 ((SimpleAdapter)difficulty.getAdapter()).notifyDataSetChanged(); |
177 |
180 } |
|
181 }); |
|
182 |
|
183 final ArrayList<HashMap<String, ?>> hatsDataNew = FrontendDataUtils.getHats(this); |
|
184 this.runOnUiThread(new Runnable(){ |
|
185 public void run() { |
178 copy(hatsData, hatsDataNew); |
186 copy(hatsData, hatsDataNew); |
179 ((SimpleAdapter)hogHat.get(0).getAdapter()).notifyDataSetChanged(); |
187 ((SimpleAdapter)hogHat.get(0).getAdapter()).notifyDataSetChanged(); |
180 |
188 } |
|
189 }); |
|
190 |
|
191 final ArrayList<String> voicesDataNew = FrontendDataUtils.getVoices(this); |
|
192 this.runOnUiThread(new Runnable(){ |
|
193 public void run() { |
181 copy(voicesData, voicesDataNew); |
194 copy(voicesData, voicesDataNew); |
182 ((ArrayAdapter<String>)voice.getAdapter()).notifyDataSetChanged(); |
195 ((ArrayAdapter<String>)voice.getAdapter()).notifyDataSetChanged(); |
183 |
196 } |
|
197 }); |
|
198 |
|
199 final ArrayList<String> fortsDataNew = FrontendDataUtils.getForts(this); |
|
200 this.runOnUiThread(new Runnable(){ |
|
201 public void run() { |
184 copy(fortsData, fortsDataNew); |
202 copy(fortsData, fortsDataNew); |
185 ((ArrayAdapter<String>)fort.getAdapter()).notifyDataSetChanged(); |
203 ((ArrayAdapter<String>)fort.getAdapter()).notifyDataSetChanged(); |
186 } |
204 } |
187 }); |
205 }); |
188 |
|
189 } |
206 } |
190 |
207 |
191 private static <T> void copy(List<T> dest, List<T> src){ |
208 private static <T> void copy(List<T> dest, List<T> src){ |
192 for(T t: src) dest.add(t); |
209 for(T t: src) dest.add(t); |
193 } |
210 } |