Revision ef6fa21a
b/src/com/rackspace/cloud/android/ContainerObjectsActivity.java | ||
---|---|---|
12 | 12 |
import android.content.Intent; |
13 | 13 |
import android.os.AsyncTask; |
14 | 14 |
import android.os.Bundle; |
15 |
import android.util.Log; |
|
15 | 16 |
import android.view.LayoutInflater; |
16 | 17 |
import android.view.Menu; |
17 | 18 |
import android.view.MenuInflater; |
... | ... | |
222 | 223 |
*/ |
223 | 224 |
private Boolean fileBelongsInDir(ContainerObjects obj){ |
224 | 225 |
String objPath = obj.getCName(); |
226 |
Log.i("INFO",currentPath); |
|
225 | 227 |
if(!objPath.startsWith(currentPath)){ |
226 | 228 |
return false; |
227 | 229 |
} |
... | ... | |
248 | 250 |
if (files != null) { |
249 | 251 |
for (int i = 0; i < files.size(); i++) { |
250 | 252 |
ContainerObjects file = files.get(i); |
253 |
Log.i(file.getCName(),file.getCName()); |
|
251 | 254 |
this.files[i] = file; |
252 | 255 |
fileNames[i] = file.getName(); |
253 | 256 |
} |
... | ... | |
562 | 565 |
protected ArrayList<ContainerObjects> doInBackground(String... path) { |
563 | 566 |
ArrayList<ContainerObjects> files = null; |
564 | 567 |
try { |
565 |
files = (new ContainerObjectManager(getContext())).createList(true, |
|
568 |
if(container.getName().equals(Container.MYSHARED)){ |
|
569 |
files = (new ContainerObjectManager(getContext())).createListMyShared(true, |
|
570 |
container.getName(),new ContainerManager(getContext()).createList(true)); |
|
571 |
} |
|
572 |
else if(container.getName().equals(Container.OTHERS)){ |
|
573 |
|
|
574 |
} |
|
575 |
else |
|
576 |
files = (new ContainerObjectManager(getContext())).createList(true, |
|
566 | 577 |
container.getName()); |
567 | 578 |
} catch (CloudServersException e) { |
568 | 579 |
exception = e; |
b/src/com/rackspace/cloud/android/ListContainerActivity.java | ||
---|---|---|
172 | 172 |
exception.getMessage()); |
173 | 173 |
} |
174 | 174 |
ArrayList<Container> containerList = result; |
175 |
|
|
175 |
if(result==null) |
|
176 |
result = new ArrayList<Container>(); |
|
177 |
Container containerToAdd = new Container(); |
|
178 |
containerToAdd.setCount(0); |
|
179 |
containerToAdd.setBytes(0); |
|
180 |
containerToAdd.setName(Container.MYSHARED); |
|
181 |
containerToAdd.setLogRetention(false); |
|
182 |
containerToAdd.setCdnEnabled(false); |
|
183 |
containerToAdd.setTtl(0); |
|
184 |
containerList.add(containerToAdd); |
|
185 |
containerToAdd = new Container(); |
|
186 |
containerToAdd.setCount(0); |
|
187 |
containerToAdd.setBytes(0); |
|
188 |
containerToAdd.setName(Container.OTHERS); |
|
189 |
containerToAdd.setLogRetention(false); |
|
190 |
containerToAdd.setCdnEnabled(false); |
|
191 |
containerToAdd.setTtl(0); |
|
192 |
containerList.add(containerToAdd); |
|
193 |
|
|
176 | 194 |
if (containerList != null) { |
177 | 195 |
containerNames = new String[containerList.size()]; |
178 | 196 |
containers = new Container[containerList.size()]; |
b/src/com/rackspace/cloud/files/api/client/Container.java | ||
---|---|---|
11 | 11 |
public class Container extends Entity { |
12 | 12 |
|
13 | 13 |
private static final long serialVersionUID = 5994739895998309675L; |
14 |
|
|
14 |
public static final String MYSHARED="MyShared"; |
|
15 |
public static final String OTHERS="Others"; |
|
15 | 16 |
// Regular attributes |
16 | 17 |
private String name; |
17 | 18 |
private int count; |
b/src/com/rackspace/cloud/files/api/client/ContainerObjectManager.java | ||
---|---|---|
7 | 7 |
import java.net.URI; |
8 | 8 |
import java.net.URISyntaxException; |
9 | 9 |
import java.util.ArrayList; |
10 |
import java.util.List; |
|
10 | 11 |
|
11 | 12 |
import javax.xml.parsers.FactoryConfigurationError; |
12 | 13 |
import javax.xml.parsers.ParserConfigurationException; |
... | ... | |
77 | 78 |
|
78 | 79 |
xmlReader.parse(new InputSource(new StringReader(body))); |
79 | 80 |
files = filesXMLParser.getViewFiles(); |
81 |
for(ContainerObjects o :files) |
|
82 |
o.setContainerName(passName); |
|
80 | 83 |
|
81 | 84 |
} else { |
82 | 85 |
CloudServersFaultXMLParser parser = new CloudServersFaultXMLParser(); |
... | ... | |
112 | 115 |
return files; |
113 | 116 |
|
114 | 117 |
} |
118 |
|
|
119 |
public ArrayList<ContainerObjects> createListMyShared(boolean detail, |
|
120 |
String passName, List<Container> containers) throws CloudServersException { |
|
121 |
|
|
122 |
ArrayList<ContainerObjects> files = new ArrayList<ContainerObjects>(); |
|
123 |
for(Container con :containers ){ |
|
124 |
if(con.getName().equalsIgnoreCase("trash")||con.getName().equals(Container.MYSHARED)||con.getName().equals(Container.OTHERS)){} |
|
125 |
else |
|
126 |
try{ |
|
127 |
ArrayList<ContainerObjects> temp = createList(detail, con.getName()); |
|
128 |
for(ContainerObjects o : temp){ |
|
129 |
if(o.isShared()) |
|
130 |
files.add(o); |
|
131 |
} |
|
132 |
} |
|
133 |
catch(CloudServersException e){ |
|
134 |
|
|
135 |
} |
|
136 |
} |
|
137 |
return files; |
|
138 |
|
|
139 |
} |
|
115 | 140 |
|
116 | 141 |
public HttpBundle deleteObject(String Container, String Object) |
117 | 142 |
throws CloudServersException { |
b/src/com/rackspace/cloud/files/api/client/ContainerObjects.java | ||
---|---|---|
17 | 17 |
private int bytes; |
18 | 18 |
private String cname; |
19 | 19 |
private String contentType; |
20 |
|
|
20 |
private String containerName; |
|
21 |
|
|
21 | 22 |
private boolean isFolder() { |
22 | 23 |
return contentType.startsWith("application/folder;"); |
23 | 24 |
} |
25 |
|
|
26 |
public boolean isShared(){ |
|
27 |
if(getIsPublic()!=null){ |
|
28 |
return true; |
|
29 |
} |
|
30 |
if(getObjectSharing()!=null){ |
|
31 |
if(getObjectSharing().split(":").length>1) |
|
32 |
return true; |
|
33 |
} |
|
34 |
return false; |
|
35 |
} |
|
36 |
|
|
37 |
public String getContainerName() { |
|
38 |
return containerName; |
|
39 |
} |
|
40 |
|
|
41 |
public void setContainerName(String containerName) { |
|
42 |
this.containerName = containerName; |
|
43 |
} |
|
24 | 44 |
|
25 | 45 |
/** |
26 | 46 |
* |
Also available in: Unified diff