commit 732d9c2ce4438138724b576f82435c8a42dd7c06
Author: koutsoub <koutsoub@gmail.com>
Date:   Mon Jan 9 15:02:35 2012 +0200

    tabview in object details, show metadata and permissions, add/delete group

diff --git a/src/com/rackspace/cloud/android/ContainerObjectDetails.java b/src/com/rackspace/cloud/android/ContainerObjectDetails.java
index 2810e78..e117c1b 100644
--- a/src/com/rackspace/cloud/android/ContainerObjectDetails.java
+++ b/src/com/rackspace/cloud/android/ContainerObjectDetails.java
@@ -27,13 +27,19 @@ import android.view.Menu;
 import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
+import android.view.View.OnClickListener;
 import android.widget.Button;
+import android.widget.CheckBox;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
 import android.widget.LinearLayout;
+import android.widget.TabHost;
 import android.widget.TextView;
 import android.widget.Toast;
 
 import com.rackspace.cloud.files.api.client.ContainerObjectManager;
 import com.rackspace.cloud.files.api.client.ContainerObjects;
+import com.rackspace.cloud.files.api.client.Permission;
 import com.rackspace.cloud.servers.api.client.CloudServersException;
 import com.rackspace.cloud.servers.api.client.http.HttpBundle;
 
@@ -75,7 +81,32 @@ public class ContainerObjectDetails extends CloudActivity {
 		cdnURL = (String) this.getIntent().getExtras().get("cdnUrl");
 		cdnEnabled = (String) this.getIntent().getExtras().get("isCdnEnabled");
 
-		setContentView(R.layout.viewobject);       
+		setContentView(R.layout.viewobject); 
+		TabHost tabs = (TabHost)findViewById(R.id.tabhost2);
+
+        tabs.setup();
+
+        TabHost.TabSpec spec = tabs.newTabSpec("tag1");
+
+        spec.setContent(R.id.details);
+        spec.setIndicator("Details");
+        tabs.addTab(spec);
+
+        spec = tabs.newTabSpec("tag2");
+        spec.setContent(R.id.metadata);
+        spec.setIndicator("Metadata");
+        tabs.addTab(spec);
+        
+        spec = tabs.newTabSpec("tag3");
+        spec.setContent(R.id.sharing);
+        spec.setIndicator("Sharing");
+        tabs.addTab(spec);
+        
+        spec = tabs.newTabSpec("tag4");
+        spec.setContent(R.id.versions);
+        spec.setIndicator("Versions");
+        tabs.addTab(spec);
+        
 		restoreState(savedInstanceState);
 	}
 
@@ -183,6 +214,7 @@ public class ContainerObjectDetails extends CloudActivity {
 		TextView lastmod = (TextView) findViewById(R.id.view_file_modification);
 		lastmod.setText(strDate);    	  
 		rebuildMetadataList();
+		rebuildPermissionList();
 	}
 	
 	private void rebuildMetadataList(){
@@ -211,6 +243,65 @@ public class ContainerObjectDetails extends CloudActivity {
 		((TextView) v.findViewById(R.id.mvalue)).setText(metadata.getValue());
 	}
 
+	
+	private void rebuildPermissionList(){
+		LayoutInflater layoutInflater = LayoutInflater.from(ContainerObjectDetails.this);
+		final LinearLayout properties = (LinearLayout) findViewById(R.id.permissionsList);
+		if(properties.getChildCount()>0)
+			properties.removeViews(0,properties.getChildCount());
+		properties.removeAllViews();
+		Iterator<Permission> it=null;
+		if(objects.getPermissions()!=null){
+			it= objects.getPermissions().iterator();
+			int i = 0;
+			while (it.hasNext()) {
+				final Permission perm = it.next();
+				final View v = layoutInflater.inflate(R.layout.propertiesrow, null);
+				populatePermissionList(perm, v, properties, i);
+				i++;
+			}
+		}
+	}
+	
+	private void populatePermissionList(final Permission perm, final View v, final LinearLayout properties, int i){
+		
+		
+		properties.addView(v, i);
+		
+		
+		
+		((TextView) v.findViewById(R.id.ownerName)).setText(perm.getUser());
+		((CheckBox) v.findViewById(R.id.read)).setChecked(perm.isRead());
+		((CheckBox) v.findViewById(R.id.write)).setChecked(perm.isWrite());
+		
+		((CheckBox) v.findViewById(R.id.read)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
+
+			@Override
+			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+				perm.setRead(isChecked);
+
+			}
+		});
+		((CheckBox) v.findViewById(R.id.write)).setOnCheckedChangeListener(new OnCheckedChangeListener() {
+
+			@Override
+			public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
+				perm.setWrite(isChecked);
+
+			}
+		});
+		((Button) v.findViewById(R.id.remove)).setOnClickListener(new OnClickListener() {
+
+			@Override
+			public void onClick(View v1) {
+				properties.removeView(v);
+				objects.getPermissions().remove(perm);
+
+			}
+		});
+	}
+	
+	
 	private class MyOnClickListener implements View.OnClickListener {
 		@Override
 		public void onClick(View v) {
