Switch edit UI to tabs, TYPE_ASSERT for version, cleanup.

Integrated with the tabs and header widget built by
emillar, kept separate from BaseContactCardActivity since
I'm handling EDIT/INSERT intents differently.  Added hooks
to pick primary photo/name from header.

Cleaned up the colorful testing UI, added padding to match
mocks, and initial pass at collapsed secondary area.  Added
back menu items and confirmation toast.

Changed to new TYPE_ASSERT ContentProviderOperation for
asserting RawContacts.VERSION number during updates.
diff --git a/res/color-finger/kind_title.xml b/res/color-finger/kind_title.xml
new file mode 100644
index 0000000..7489f75
--- /dev/null
+++ b/res/color-finger/kind_title.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<selector xmlns:android="http://schemas.android.com/apk/res/android">
+    <item android:color="@*android:color/bright_foreground_dark" />
+</selector>
diff --git a/res/layout/act_edit.xml b/res/layout/act_edit.xml
index ab04e25..1a9f99c 100644
--- a/res/layout/act_edit.xml
+++ b/res/layout/act_edit.xml
@@ -21,13 +21,22 @@
     android:fillViewport="true">
 
     <LinearLayout
+        android:id="@+id/panel"
         android:layout_width="fill_parent"
         android:layout_height="fill_parent"
         android:orientation="vertical"
         android:fillViewport="true">
 
-        <!-- TODO: insert aggregate summary widget -->
-        <!-- TODO: insert contact tab widget -->
+        <com.android.internal.widget.ContactHeaderWidget
+            android:id="@+id/contact_header_widget"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content" />
+
+        <com.android.contacts.ScrollingTabWidget
+            android:id="@+id/tab_widget"
+            android:layout_width="fill_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/tab_widget_bg" />
 
         <FrameLayout
             android:id="@android:id/tabcontent"
diff --git a/res/layout/act_edit_contact.xml b/res/layout/act_edit_contact.xml
index b052671..86b010f 100644
--- a/res/layout/act_edit_contact.xml
+++ b/res/layout/act_edit_contact.xml
@@ -23,20 +23,21 @@
 
     <TextView
         android:id="@+id/text_summary"
-android:background="#f0f0"
         android:layout_width="fill_parent"
-        android:layout_height="wrap_content" />
+        android:layout_height="0dip" />
 
     <FrameLayout
         android:id="@+id/hook_photo"
-android:background="#f00f"
         android:layout_width="76dip"
         android:layout_height="76dip"
+        android:layout_marginTop="4dip"
+        android:layout_marginLeft="2dip"
+        android:layout_marginBottom="4dip"
+        android:layout_marginRight="4dip"
         android:layout_below="@+id/text_summary" />
 
     <FrameLayout
         android:id="@+id/hook_displayname"
-android:background="#fff0"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_alignTop="@+id/hook_photo"
@@ -45,26 +46,35 @@
 
     <LinearLayout
         android:id="@+id/sect_general"
-android:background="#f0ff"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_below="@+id/hook_photo"
         android:orientation="vertical" />
 
-    <!-- TODO: make secondary section collapsable -->
     <TextView
-android:background="#ff00"
         android:id="@+id/head_secondary"
         android:layout_width="fill_parent"
-        android:layout_height="10dip"
-        android:layout_below="@+id/sect_general" />
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/sect_general"
+        android:gravity="center_vertical"
+        android:minHeight="?android:attr/listPreferredItemHeight"
+        android:background="@color/sect_secondary"
+        android:text="@string/edit_secondary_collapse"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="@color/kind_title"
+        android:singleLine="true"
+        android:ellipsize="marquee"
+        android:focusable="true"
+        android:clickable="true"
+        android:paddingLeft="10dip"
+        android:drawablePadding="10dip" />
 
     <LinearLayout
-android:background="#ff0f"
         android:id="@+id/sect_secondary"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
         android:layout_below="@+id/head_secondary"
+        android:background="@color/sect_secondary"
         android:orientation="vertical" />
 
 </RelativeLayout>
diff --git a/res/layout/item_edit_kind.xml b/res/layout/item_edit_kind.xml
index e01f160..fd68a00 100644
--- a/res/layout/item_edit_kind.xml
+++ b/res/layout/item_edit_kind.xml
@@ -20,18 +20,25 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
+    android:minHeight="?android:attr/listPreferredItemHeight"
     android:orientation="vertical">
 
+    <View
+        android:layout_width="fill_parent"
+        android:layout_height="wrap_content"
+        android:background="?android:attr/listDivider" />
+
     <LinearLayout
         android:id="@+id/kind_header"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
+        android:layout_weight="1"
         android:layout_marginLeft="14dip"
-        android:layout_marginTop="3dip"
-        android:layout_marginBottom="1dip"
+        android:layout_marginTop="2dip"
+        android:layout_marginBottom="2dip"
         android:layout_marginRight="?android:attr/scrollbarSize"
         android:orientation="horizontal"
-        android:gravity="bottom"
+        android:gravity="center_vertical"
         android:focusable="true"
         android:clickable="true">
 
@@ -40,8 +47,8 @@
             android:layout_width="0dip"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:layout_marginBottom="8dip"
             android:textAppearance="?android:attr/textAppearanceMedium"
+            android:textColor="@color/kind_title"
             android:singleLine="true"
             android:ellipsize="marquee"
             android:fadingEdge="horizontal" />
@@ -58,6 +65,7 @@
         android:id="@+id/kind_editors"
         android:layout_width="fill_parent"
         android:layout_height="wrap_content"
+        android:paddingBottom="6dip"
         android:orientation="vertical" />
 
 </LinearLayout>
diff --git a/res/layout/item_editor_displayname.xml b/res/layout/item_editor_displayname.xml
index ae6d815..b819d80 100644
--- a/res/layout/item_editor_displayname.xml
+++ b/res/layout/item_editor_displayname.xml
@@ -18,7 +18,8 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="fill_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical">
+    android:orientation="vertical"
+    android:gravity="center_vertical">
 
     <EditText
         android:id="@+id/name"
diff --git a/res/layout/item_editor_photo.xml b/res/layout/item_editor_photo.xml
index d4fcf13..4a32a67 100644
--- a/res/layout/item_editor_photo.xml
+++ b/res/layout/item_editor_photo.xml
@@ -22,4 +22,5 @@
     android:focusable="true"
     android:src="@drawable/ic_menu_add_picture"
     android:scaleType="center"
-    android:background="@drawable/btn_contact_picture" />
+    android:background="@drawable/btn_contact_picture"
+    android:gravity="center" />
diff --git a/res/menu/edit.xml b/res/menu/edit.xml
new file mode 100644
index 0000000..b38aab1
--- /dev/null
+++ b/res/menu/edit.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+    <item
+        android:id="@+id/menu_done"
+        android:alphabeticShortcut="\n"
+        android:icon="@android:drawable/ic_menu_save"
+        android:title="@string/menu_done" />
+
+    <item
+        android:id="@+id/menu_discard"
+        android:alphabeticShortcut="q"
+        android:icon="@android:drawable/ic_menu_close_clear_cancel"
+        android:title="@string/menu_doNotSave" />
+
+    <item
+        android:id="@+id/menu_delete"
+        android:icon="@android:drawable/ic_menu_delete"
+        android:title="@string/menu_deleteContact" />
+
+    <item
+        android:id="@+id/menu_photo_add"
+        android:icon="@drawable/ic_menu_add_picture"
+        android:title="@string/addPicture" />
+
+    <item
+        android:id="@+id/menu_photo_remove"
+        android:icon="@android:drawable/ic_menu_delete"
+        android:title="@string/removePicture" />
+
+</menu>
diff --git a/res/values/colors.xml b/res/values/colors.xml
new file mode 100644
index 0000000..4dc08cc
--- /dev/null
+++ b/res/values/colors.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2009 The Android Open Source Project
+
+     Licensed under the Apache License, Version 2.0 (the "License");
+     you may not use this file except in compliance with the License.
+     You may obtain a copy of the License at
+
+          http://www.apache.org/licenses/LICENSE-2.0
+
+     Unless required by applicable law or agreed to in writing, software
+     distributed under the License is distributed on an "AS IS" BASIS,
+     WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+     See the License for the specific language governing permissions and
+     limitations under the License.
+-->
+
+<resources>
+    <color name="sect_secondary">#4fff</color>
+</resources>
diff --git a/res/values/ids.xml b/res/values/ids.xml
index 6bcb44d..dbf9b65 100644
--- a/res/values/ids.xml
+++ b/res/values/ids.xml
@@ -21,4 +21,10 @@
     <item type="id" name="header_all" />
     <item type="id" name="header_phones" />
 
+    <item type="id" name="dialog_delete" />
+    <item type="id" name="dialog_photo" />
+    <item type="id" name="dialog_name" />
+    <item type="id" name="dialog_label" />
+    <item type="id" name="dialog_label_custom" />
+
 </resources>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 412467e..73ad473 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -710,5 +710,8 @@
 <string name="type_im_icq">ICQ</string>
 <string name="type_im_jabber">Jabber</string>
 
+    <!-- Shown as the header title over a collapsible section that, by default, hides
+         secondary contact detail edit fields, such as birthday. -->
+    <string name="edit_secondary_collapse">Secondary details</string>
 
 </resources>