Revision 21c57799 src/com/rackspacecloud/android/AccessControlActivity.java
b/src/com/rackspacecloud/android/AccessControlActivity.java | ||
---|---|---|
136 | 136 |
setListAdapter(new NetworkItemAdapter()); |
137 | 137 |
} |
138 | 138 |
} |
139 |
|
|
140 |
private void displayLoadingCell() { |
|
141 |
String a[] = new String[1]; |
|
142 |
a[0] = "Loading..."; |
|
143 |
setListAdapter(new ArrayAdapter<String>(this, R.layout.loadingcell, R.id.loading_label, a)); |
|
144 |
getListView().setTextFilterEnabled(true); |
|
145 |
getListView().setDividerHeight(0); // hide the dividers so it won't look like a list row |
|
146 |
getListView().setItemsCanFocus(false); |
|
147 |
} |
|
139 | 148 |
|
140 | 149 |
private void displayNoRulesCell() { |
141 | 150 |
String a[] = new String[1]; |
... | ... | |
147 | 156 |
} |
148 | 157 |
|
149 | 158 |
private void loadNetworkItems() { |
159 |
displayLoadingCell(); |
|
150 | 160 |
new LoadNetworkItemsTask().execute((Void[]) null); |
151 | 161 |
} |
152 | 162 |
|
... | ... | |
187 | 197 |
|
188 | 198 |
@Override |
189 | 199 |
protected void onPreExecute(){ |
190 |
showDialog(); |
|
200 |
//set to null so will reload on config changes |
|
201 |
networkItems = null; |
|
191 | 202 |
} |
192 | 203 |
|
193 | 204 |
@Override |
... | ... | |
203 | 214 |
|
204 | 215 |
@Override |
205 | 216 |
protected void onPostExecute(ArrayList<NetworkItem> result) { |
206 |
hideDialog(); |
|
207 | 217 |
if (exception != null) { |
208 | 218 |
showAlert("Error", exception.getMessage()); |
209 | 219 |
} |
... | ... | |
214 | 224 |
private class DeleteNetworkItemTask extends AsyncTask<Void, Void, HttpBundle> { |
215 | 225 |
|
216 | 226 |
private CloudServersException exception; |
227 |
private NetworkItem networkItem; |
|
217 | 228 |
|
218 | 229 |
@Override |
219 | 230 |
//let user know their process has started |
220 | 231 |
protected void onPreExecute(){ |
221 |
showDialog(); |
|
232 |
networkItem = networkItems.get(lastSelectedRulePosition); |
|
233 |
displayLoadingCell(); |
|
234 |
//set to null so will reload on config change |
|
235 |
networkItems = null; |
|
222 | 236 |
} |
223 | 237 |
@Override |
224 | 238 |
protected HttpBundle doInBackground(Void... arg0) { |
225 | 239 |
HttpBundle bundle = null; |
226 | 240 |
try { |
227 |
bundle = new NetworkItemManager(getContext()).delete(loadBalancer, networkItems.get(lastSelectedRulePosition));
|
|
241 |
bundle = new NetworkItemManager(getContext()).delete(loadBalancer, networkItem); |
|
228 | 242 |
} catch (CloudServersException e) { |
229 | 243 |
exception = e; |
230 | 244 |
} |
... | ... | |
233 | 247 |
|
234 | 248 |
@Override |
235 | 249 |
protected void onPostExecute(HttpBundle bundle) { |
236 |
hideDialog(); |
|
237 | 250 |
HttpResponse response = bundle.getResponse(); |
238 | 251 |
if (response != null) { |
239 | 252 |
int statusCode = response.getStatusLine().getStatusCode(); |
Also available in: Unified diff