Revision 44ac7bea src/com/rackspacecloud/android/ContainerObjectsActivity.java
b/src/com/rackspacecloud/android/ContainerObjectsActivity.java | ||
---|---|---|
138 | 138 |
displayCurrentFiles(); |
139 | 139 |
} |
140 | 140 |
|
141 |
|
|
142 |
/* |
|
141 | 143 |
private void loadFiles() { |
142 | 144 |
//displayLoadingCell(); |
143 | 145 |
new LoadFilesTask().execute(); |
144 | 146 |
} |
147 |
*/ |
|
148 |
|
|
149 |
private void loadFiles(){ |
|
150 |
CloudServersException exception = null; |
|
151 |
|
|
152 |
ArrayList<ContainerObjects> result = null; |
|
153 |
try { |
|
154 |
result = (new ContainerObjectManager(context)).createList(true, |
|
155 |
container.getName()); |
|
156 |
} catch (CloudServersException e) { |
|
157 |
exception = e; |
|
158 |
e.printStackTrace(); |
|
159 |
} |
|
160 |
if (exception != null) { |
|
161 |
showAlert("Error", exception.getMessage()); |
|
162 |
} |
|
163 |
setFileList(result); |
|
164 |
} |
|
165 |
|
|
166 |
|
|
145 | 167 |
|
146 | 168 |
|
147 | 169 |
/* load only the files that should display for the |
... | ... | |
191 | 213 |
String[] fileNames = new String[files.size()]; |
192 | 214 |
this.files = new ContainerObjects[files.size()]; |
193 | 215 |
|
216 |
|
|
217 |
|
|
194 | 218 |
if (files != null) { |
195 | 219 |
for (int i = 0; i < files.size(); i++) { |
196 | 220 |
ContainerObjects file = files.get(i); |
... | ... | |
198 | 222 |
fileNames[i] = file.getName(); |
199 | 223 |
} |
200 | 224 |
} |
201 |
|
|
225 |
|
|
202 | 226 |
displayCurrentFiles(); |
203 | 227 |
} |
204 | 228 |
|
205 | 229 |
private void displayCurrentFiles(){ |
230 |
if(curDirFiles!=null) |
|
206 | 231 |
loadCurrentDirectoryFiles(); |
207 | 232 |
if (curDirFiles.length == 0) { |
208 | 233 |
displayNoServersCell(); |
... | ... | |
341 | 366 |
return true; |
342 | 367 |
case R.id.add_folder: |
343 | 368 |
showDialog(R.id.add_folder); |
369 |
return true; |
|
344 | 370 |
case R.id.add_file: |
345 | 371 |
Intent viewIntent2 = new Intent(this, AddFileActivity.class); |
346 | 372 |
viewIntent2.putExtra("Cname", container.getName()); |
... | ... | |
438 | 464 |
.setMessage("Enter new name for folder: ") |
439 | 465 |
.setPositiveButton("Add", new DialogInterface.OnClickListener() { |
440 | 466 |
public void onClick(DialogInterface dialog, int whichButton) { |
441 |
// User clicked OK so do some stuff
|
|
467 |
//User clicked OK so do some stuff |
|
442 | 468 |
String[] info = {input.getText().toString(), "application/directory"}; |
443 | 469 |
new AddFolderTask().execute(info); |
444 | 470 |
} |
... | ... | |
504 | 530 |
class FileAdapter extends ArrayAdapter<ContainerObjects> { |
505 | 531 |
FileAdapter() { |
506 | 532 |
super(ContainerObjectsActivity.this, |
507 |
R.layout.listcontainerobjectcell, curDirFiles); |
|
533 |
R.layout.listcontainerobjectcell, curDirFiles);
|
|
508 | 534 |
} |
509 | 535 |
|
510 | 536 |
public View getView(int position, View convertView, ViewGroup parent) { |
... | ... | |
539 | 565 |
AsyncTask<String, Void, ArrayList<ContainerObjects>> { |
540 | 566 |
|
541 | 567 |
private CloudServersException exception; |
542 |
|
|
568 |
/* |
|
543 | 569 |
protected void onPreExecute(){ |
544 | 570 |
dialog = ProgressDialog.show(ContainerObjectsActivity.this, "", "Loading Files...", true); |
545 | 571 |
} |
546 |
|
|
572 |
*/ |
|
547 | 573 |
@Override |
548 | 574 |
protected ArrayList<ContainerObjects> doInBackground(String... path) { |
549 | 575 |
ArrayList<ContainerObjects> files = null; |
... | ... | |
559 | 585 |
|
560 | 586 |
@Override |
561 | 587 |
protected void onPostExecute(ArrayList<ContainerObjects> result) { |
562 |
dialog.dismiss(); |
|
588 |
//dialog.dismiss();
|
|
563 | 589 |
if (exception != null) { |
564 | 590 |
showAlert("Error", exception.getMessage()); |
565 | 591 |
} |
... | ... | |
590 | 616 |
|
591 | 617 |
@Override |
592 | 618 |
protected void onPostExecute(HttpResponse response) { |
619 |
dialog.dismiss(); |
|
593 | 620 |
if (response != null) { |
594 | 621 |
int statusCode = response.getStatusLine().getStatusCode(); |
595 | 622 |
if (statusCode == 409) { |
... | ... | |
600 | 627 |
setResult(Activity.RESULT_OK); |
601 | 628 |
removeFromList(currentPath); |
602 | 629 |
goUpDirectory(); |
603 |
dialog.dismiss(); |
|
630 |
|
|
604 | 631 |
} else { |
605 | 632 |
CloudServersException cse = parseCloudServersException(response); |
606 | 633 |
if ("".equals(cse.getMessage())) { |
... | ... | |
624 | 651 |
|
625 | 652 |
private CloudServersException exception; |
626 | 653 |
|
627 |
protected void onPreExecute(){ |
|
628 |
dialog = ProgressDialog.show(ContainerObjectsActivity.this, "", "Adding Folder...", true); |
|
629 |
} |
|
630 |
|
|
631 | 654 |
@Override |
632 | 655 |
protected HttpResponse doInBackground(String... data) { |
633 | 656 |
HttpResponse resp = null; |
... | ... | |
641 | 664 |
|
642 | 665 |
@Override |
643 | 666 |
protected void onPostExecute(HttpResponse response) { |
644 |
dialog.dismiss(); |
|
667 |
//dialog.dismiss();
|
|
645 | 668 |
if (response != null) { |
646 | 669 |
int statusCode = response.getStatusLine().getStatusCode(); |
647 | 670 |
if (statusCode == 201) { |
Also available in: Unified diff