Revision 732d9c2c src/com/rackspace/cloud/android/ContainerObjectDetails.java
b/src/com/rackspace/cloud/android/ContainerObjectDetails.java | ||
---|---|---|
27 | 27 |
import android.view.MenuInflater; |
28 | 28 |
import android.view.MenuItem; |
29 | 29 |
import android.view.View; |
30 |
import android.view.View.OnClickListener; |
|
30 | 31 |
import android.widget.Button; |
32 |
import android.widget.CheckBox; |
|
33 |
import android.widget.CompoundButton; |
|
34 |
import android.widget.CompoundButton.OnCheckedChangeListener; |
|
31 | 35 |
import android.widget.LinearLayout; |
36 |
import android.widget.TabHost; |
|
32 | 37 |
import android.widget.TextView; |
33 | 38 |
import android.widget.Toast; |
34 | 39 |
|
35 | 40 |
import com.rackspace.cloud.files.api.client.ContainerObjectManager; |
36 | 41 |
import com.rackspace.cloud.files.api.client.ContainerObjects; |
42 |
import com.rackspace.cloud.files.api.client.Permission; |
|
37 | 43 |
import com.rackspace.cloud.servers.api.client.CloudServersException; |
38 | 44 |
import com.rackspace.cloud.servers.api.client.http.HttpBundle; |
39 | 45 |
|
... | ... | |
75 | 81 |
cdnURL = (String) this.getIntent().getExtras().get("cdnUrl"); |
76 | 82 |
cdnEnabled = (String) this.getIntent().getExtras().get("isCdnEnabled"); |
77 | 83 |
|
78 |
setContentView(R.layout.viewobject); |
|
84 |
setContentView(R.layout.viewobject); |
|
85 |
TabHost tabs = (TabHost)findViewById(R.id.tabhost2); |
|
86 |
|
|
87 |
tabs.setup(); |
|
88 |
|
|
89 |
TabHost.TabSpec spec = tabs.newTabSpec("tag1"); |
|
90 |
|
|
91 |
spec.setContent(R.id.details); |
|
92 |
spec.setIndicator("Details"); |
|
93 |
tabs.addTab(spec); |
|
94 |
|
|
95 |
spec = tabs.newTabSpec("tag2"); |
|
96 |
spec.setContent(R.id.metadata); |
|
97 |
spec.setIndicator("Metadata"); |
|
98 |
tabs.addTab(spec); |
|
99 |
|
|
100 |
spec = tabs.newTabSpec("tag3"); |
|
101 |
spec.setContent(R.id.sharing); |
|
102 |
spec.setIndicator("Sharing"); |
|
103 |
tabs.addTab(spec); |
|
104 |
|
|
105 |
spec = tabs.newTabSpec("tag4"); |
|
106 |
spec.setContent(R.id.versions); |
|
107 |
spec.setIndicator("Versions"); |
|
108 |
tabs.addTab(spec); |
|
109 |
|
|
79 | 110 |
restoreState(savedInstanceState); |
80 | 111 |
} |
81 | 112 |
|
... | ... | |
183 | 214 |
TextView lastmod = (TextView) findViewById(R.id.view_file_modification); |
184 | 215 |
lastmod.setText(strDate); |
185 | 216 |
rebuildMetadataList(); |
217 |
rebuildPermissionList(); |
|
186 | 218 |
} |
187 | 219 |
|
188 | 220 |
private void rebuildMetadataList(){ |
... | ... | |
211 | 243 |
((TextView) v.findViewById(R.id.mvalue)).setText(metadata.getValue()); |
212 | 244 |
} |
213 | 245 |
|
246 |
|
|
247 |
private void rebuildPermissionList(){ |
|
248 |
LayoutInflater layoutInflater = LayoutInflater.from(ContainerObjectDetails.this); |
|
249 |
final LinearLayout properties = (LinearLayout) findViewById(R.id.permissionsList); |
|
250 |
if(properties.getChildCount()>0) |
|
251 |
properties.removeViews(0,properties.getChildCount()); |
|
252 |
properties.removeAllViews(); |
|
253 |
Iterator<Permission> it=null; |
|
254 |
if(objects.getPermissions()!=null){ |
|
255 |
it= objects.getPermissions().iterator(); |
|
256 |
int i = 0; |
|
257 |
while (it.hasNext()) { |
|
258 |
final Permission perm = it.next(); |
|
259 |
final View v = layoutInflater.inflate(R.layout.propertiesrow, null); |
|
260 |
populatePermissionList(perm, v, properties, i); |
|
261 |
i++; |
|
262 |
} |
|
263 |
} |
|
264 |
} |
|
265 |
|
|
266 |
private void populatePermissionList(final Permission perm, final View v, final LinearLayout properties, int i){ |
|
267 |
|
|
268 |
|
|
269 |
properties.addView(v, i); |
|
270 |
|
|
271 |
|
|
272 |
|
|
273 |
((TextView) v.findViewById(R.id.ownerName)).setText(perm.getUser()); |
|
274 |
((CheckBox) v.findViewById(R.id.read)).setChecked(perm.isRead()); |
|
275 |
((CheckBox) v.findViewById(R.id.write)).setChecked(perm.isWrite()); |
|
276 |
|
|
277 |
((CheckBox) v.findViewById(R.id.read)).setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
278 |
|
|
279 |
@Override |
|
280 |
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
281 |
perm.setRead(isChecked); |
|
282 |
|
|
283 |
} |
|
284 |
}); |
|
285 |
((CheckBox) v.findViewById(R.id.write)).setOnCheckedChangeListener(new OnCheckedChangeListener() { |
|
286 |
|
|
287 |
@Override |
|
288 |
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { |
|
289 |
perm.setWrite(isChecked); |
|
290 |
|
|
291 |
} |
|
292 |
}); |
|
293 |
((Button) v.findViewById(R.id.remove)).setOnClickListener(new OnClickListener() { |
|
294 |
|
|
295 |
@Override |
|
296 |
public void onClick(View v1) { |
|
297 |
properties.removeView(v); |
|
298 |
objects.getPermissions().remove(perm); |
|
299 |
|
|
300 |
} |
|
301 |
}); |
|
302 |
} |
|
303 |
|
|
304 |
|
|
214 | 305 |
private class MyOnClickListener implements View.OnClickListener { |
215 | 306 |
@Override |
216 | 307 |
public void onClick(View v) { |
Also available in: Unified diff