Revision 666c8e11 src/com/rackspace/cloud/android/ContainerObjectDetails.java
b/src/com/rackspace/cloud/android/ContainerObjectDetails.java | ||
---|---|---|
149 | 149 |
if (state != null && state.containsKey("container")) { |
150 | 150 |
objects = (ContainerObjects) state.getSerializable("container"); |
151 | 151 |
} |
152 |
loadObjectData(); |
|
152 |
if(containerNames.equals(Container.MYSHARED)||containerNames.equals(Container.OTHERS)) |
|
153 |
loadObjectData(); |
|
154 |
else |
|
155 |
new ContainerObjectRefreshTask().execute(null); |
|
153 | 156 |
|
154 | 157 |
if (cdnEnabled.equals("true")) { |
155 | 158 |
this.previewButton = (Button) findViewById(R.id.preview_button); |
... | ... | |
228 | 231 |
|
229 | 232 |
// Content Type |
230 | 233 |
TextView cType = (TextView) findViewById(R.id.view_content_type); |
231 |
cType.setText(objects.getContentType().toString()); |
|
234 |
if(objects.getContentType()!=null) |
|
235 |
cType.setText(objects.getContentType().toString()); |
|
236 |
else |
|
237 |
cType.setText(""); |
|
232 | 238 |
|
233 | 239 |
// Last Modification date |
234 | 240 |
String strDate = objects.getLastMod(); |
... | ... | |
584 | 590 |
|
585 | 591 |
@Override |
586 | 592 |
public void onClick(View v1) { |
587 |
|
|
593 |
if (storageIsReady()) { |
|
594 |
new ContainerObjectDownloadTask().execute(String.valueOf(perm.getVersion())); |
|
595 |
} else { |
|
596 |
showAlert("Error", "Storage not found."); |
|
597 |
} |
|
588 | 598 |
// getDownloadTask().execute(perm.getUri()+"?version="+perm.getVersion()); |
589 | 599 |
// properties.removeView(v); |
590 | 600 |
|
... | ... | |
636 | 646 |
showDialog(deleteObject); |
637 | 647 |
return true; |
638 | 648 |
case R.id.refresh: |
639 |
loadObjectData(); |
|
649 |
if(containerNames.equals(Container.MYSHARED)||containerNames.equals(Container.OTHERS)) |
|
650 |
loadObjectData(); |
|
651 |
else |
|
652 |
new ContainerObjectRefreshTask().execute(null); |
|
653 |
|
|
640 | 654 |
return true; |
641 | 655 |
case R.id.save: |
642 | 656 |
new ContainerObjectUpdateTask().execute(); |
... | ... | |
774 | 788 |
} |
775 | 789 |
|
776 | 790 |
// Task's |
791 |
|
|
792 |
private class ContainerObjectRefreshTask extends |
|
793 |
AsyncTask<Void, Void, ContainerObjects> { |
|
794 |
|
|
795 |
private CloudServersException exception; |
|
796 |
|
|
797 |
protected void onPreExecute() { |
|
798 |
showDialog(); |
|
799 |
app.setDeleteingObject(true); |
|
800 |
deleteObjTask = new DeleteObjectListenerTask(); |
|
801 |
deleteObjTask.execute(); |
|
802 |
} |
|
803 |
|
|
804 |
@Override |
|
805 |
protected ContainerObjects doInBackground(Void... arg0) { |
|
806 |
ContainerObjects bundle = null; |
|
807 |
try { |
|
808 |
bundle = (new ContainerObjectManager(getContext())) |
|
809 |
.executeHead(containerNames, objects.getCName()); |
|
810 |
} catch (CloudServersException e) { |
|
811 |
exception = e; |
|
812 |
} |
|
813 |
|
|
814 |
return bundle; |
|
815 |
} |
|
816 |
|
|
817 |
@Override |
|
818 |
protected void onPostExecute(ContainerObjects bundle) { |
|
819 |
hideDialog(); |
|
820 |
if (bundle != null) { |
|
821 |
objects=bundle; |
|
822 |
loadObjectData(); |
|
823 |
} else if (exception != null) { |
|
824 |
showToast("There was a problem deleting your file: " |
|
825 |
+ exception.getMessage()); |
|
826 |
} |
|
827 |
} |
|
828 |
} |
|
777 | 829 |
|
778 | 830 |
private class ContainerObjectDeleteTask extends |
779 | 831 |
AsyncTask<Void, Void, HttpBundle> { |
... | ... | |
827 | 879 |
} |
828 | 880 |
|
829 | 881 |
private class ContainerObjectDownloadTask extends |
830 |
AsyncTask<Void, Void, HttpBundle> {
|
|
882 |
AsyncTask<String, Void, HttpBundle> {
|
|
831 | 883 |
|
832 | 884 |
private CloudServersException exception; |
833 | 885 |
|
... | ... | |
840 | 892 |
} |
841 | 893 |
|
842 | 894 |
@Override |
843 |
protected HttpBundle doInBackground(Void... arg0) {
|
|
895 |
protected HttpBundle doInBackground(String... arg0) {
|
|
844 | 896 |
HttpBundle bundle = null; |
845 | 897 |
try { |
846 |
bundle = (new ContainerObjectManager(getContext())).getObject( |
|
898 |
if(arg0.length==1 && arg0[0]!=null) |
|
899 |
bundle = (new ContainerObjectManager(getContext())).getObject( |
|
900 |
containerNames, objects.getCName(),arg0[0]); |
|
901 |
else |
|
902 |
bundle = (new ContainerObjectManager(getContext())).getObject( |
|
847 | 903 |
containerNames, objects.getCName()); |
848 | 904 |
} catch (CloudServersException e) { |
849 | 905 |
exception = e; |
Also available in: Unified diff