Modal field editors

Bug:2680726
Change-Id: I167b02c50653abfa22ed72023993c9dd31f752a9
diff --git a/res/layout/contact_detail.xml b/res/layout/contact_detail_fragment.xml
similarity index 88%
rename from res/layout/contact_detail.xml
rename to res/layout/contact_detail_fragment.xml
index 10d3e48..8c1bef4 100644
--- a/res/layout/contact_detail.xml
+++ b/res/layout/contact_detail_fragment.xml
@@ -20,21 +20,23 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
     
-    <com.android.internal.widget.ContactHeaderWidget
+    <com.android.contacts.views.detail.ContactDetailHeaderView
         android:id="@+id/contact_header_widget"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"/>
         
     <ListView android:id="@android:id/list"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1"
         android:background="@drawable/title_bar_shadow"
     />
     
     <ScrollView android:id="@android:id/empty"
         android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:fillViewport="true"
+        android:layout_height="0px"
+        android:layout_weight="1"
+        android:visibility="gone"
     >
         <TextView android:id="@+id/emptyText"
             android:layout_width="match_parent"
@@ -48,6 +50,5 @@
             android:lineSpacingMultiplier="0.92"
         />
     </ScrollView>
-            
 </LinearLayout>
 
diff --git a/res/layout/contact_detail_header_view.xml b/res/layout/contact_detail_header_view.xml
new file mode 100644
index 0000000..dc8239a
--- /dev/null
+++ b/res/layout/contact_detail_header_view.xml
@@ -0,0 +1,126 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/banner"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    android:background="@drawable/title_bar_medium"
+    android:paddingRight="5dip">
+
+    <android.widget.QuickContactBadge android:id="@+id/photo"
+        android:layout_gravity="center_vertical"
+        android:layout_marginRight="8dip"
+        android:layout_marginLeft="-1dip"
+        style="@*android:style/Widget.QuickContactBadge.WindowSmall" />
+    />
+
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:layout_gravity="center_vertical" >
+
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:orientation="horizontal">
+
+            <ImageView
+                android:id="@+id/aggregate_badge"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:paddingRight="3dip"
+                android:paddingTop="3dip"
+                android:src="@drawable/ic_aggregated"
+                android:visibility="gone"
+            />
+
+            <TextView android:id="@+id/name"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:ellipsize="end"
+                android:textAppearance="?android:attr/textAppearanceMedium"
+                android:textStyle="bold"
+                android:shadowColor="#BB000000"
+                android:shadowRadius="2.75"
+                />
+        </LinearLayout>
+
+        <TextView android:id="@+id/phonetic_name"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/status"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:singleLine="true"
+            android:ellipsize="end"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+
+        <TextView android:id="@+id/status_date"
+            android:layout_width="match_parent"
+            android:layout_height="0dip"
+            android:layout_weight="1"
+            android:textAppearance="?android:attr/textAppearanceSmall"
+            android:textSize="12sp"
+            android:layout_marginTop="-2dip"
+            android:visibility="gone"
+        />
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/presence"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:paddingLeft="3dip"
+        android:paddingRight="6dip"
+        android:visibility="gone"
+    />
+
+    <ImageButton
+        android:id="@+id/edit"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:visibility="visible"
+        android:contentDescription="@string/description_edit"
+        android:src="@drawable/edit"
+        android:paddingRight="15dip"
+        android:background="#0000" />
+
+    <CheckBox
+        android:id="@+id/star"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="center_vertical"
+        android:visibility="gone"
+        android:contentDescription="@string/description_star"
+        style="?android:attr/starStyle" />
+</LinearLayout>
diff --git a/res/layout/contact_edit.xml b/res/layout/contact_edit.xml
deleted file mode 100644
index 25dff3f..0000000
--- a/res/layout/contact_edit.xml
+++ /dev/null
@@ -1,62 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2007 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.
--->
-
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/contact_edit"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical"
->
-
-    <ScrollView
-        android:layout_width="match_parent"
-        android:layout_height="1px"
-        android:layout_weight="1"
-        android:fillViewport="true"
-    >
-
-        <LinearLayout android:id="@+id/editors"
-            android:layout_width="match_parent"
-            android:layout_height="match_parent"
-            android:orientation="vertical"
-        />
-
-    </ScrollView>
-
-    <LinearLayout
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:orientation="horizontal"
-        style="@android:style/ButtonBar"
-    >
-
-        <Button android:id="@+id/btn_done"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/menu_done"
-        />
-
-        <Button android:id="@+id/btn_discard"
-            android:layout_width="0dip"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:text="@string/menu_doNotSave"
-        />
-
-    </LinearLayout>
-
-</LinearLayout>
diff --git a/res/layout/contact_edit_activity.xml b/res/layout/contact_editor_activity.xml
similarity index 87%
rename from res/layout/contact_edit_activity.xml
rename to res/layout/contact_editor_activity.xml
index d01d031..3768f6a 100644
--- a/res/layout/contact_edit_activity.xml
+++ b/res/layout/contact_editor_activity.xml
@@ -19,8 +19,8 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <fragment android:name="com.android.contacts.views.edit.ContactEditFragment"
-            android:id="@+id/contact_edit_fragment"
+    <fragment android:name="com.android.contacts.views.editor.ContactEditorFragment"
+            android:id="@+id/contact_editor_fragment"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_weight="1" />
diff --git a/res/layout/contact_edit_activity.xml b/res/layout/contact_editor_fragment.xml
similarity index 65%
copy from res/layout/contact_edit_activity.xml
copy to res/layout/contact_editor_fragment.xml
index d01d031..3324d35 100644
--- a/res/layout/contact_edit_activity.xml
+++ b/res/layout/contact_editor_fragment.xml
@@ -15,13 +15,21 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/contact_detail"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <fragment android:name="com.android.contacts.views.edit.ContactEditFragment"
-            android:id="@+id/contact_edit_fragment"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_weight="1" />
+    <com.android.contacts.views.editor.ContactEditorHeaderView
+        android:id="@+id/contact_header_widget"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
+
+    <ListView android:id="@android:id/list"
+        android:layout_width="match_parent"
+        android:layout_height="0px"
+        android:layout_weight="1"
+        android:background="@drawable/title_bar_shadow"
+    />
 </LinearLayout>
+
diff --git a/res/layout/contact_editor_header_view.xml b/res/layout/contact_editor_header_view.xml
new file mode 100644
index 0000000..fb5596e
--- /dev/null
+++ b/res/layout/contact_editor_header_view.xml
@@ -0,0 +1,56 @@
+<?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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/banner"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="horizontal"
+    android:background="@drawable/title_bar_medium"
+    android:paddingRight="5dip">
+
+    <TextView android:id="@+id/caption"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:ellipsize="end"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textStyle="bold"
+        android:shadowColor="#BB000000"
+        android:shadowRadius="2.75"
+        android:text="@string/edit_contact"
+        android:layout_gravity="center_vertical"
+        />
+
+    <LinearLayout
+        android:layout_width="0dip"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:layout_gravity="center_vertical" />
+
+    <TextView android:id="@+id/merge_info"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:singleLine="true"
+        android:ellipsize="end"
+        android:textAppearance="?android:attr/textAppearanceSmall"
+        android:textStyle="bold"
+        android:shadowColor="#BB000000"
+        android:shadowRadius="2.75"
+        android:layout_gravity="center_vertical"
+        />
+</LinearLayout>
diff --git a/res/layout/contact_field_editor_email_fragment.xml b/res/layout/contact_field_editor_email_fragment.xml
new file mode 100644
index 0000000..96fbbd2
--- /dev/null
+++ b/res/layout/contact_field_editor_email_fragment.xml
@@ -0,0 +1,112 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2007 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.
+-->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="300dip"
+    android:layout_height="240dip"
+    android:orientation="vertical"
+>
+
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="horizontal" >
+        <ImageButton
+                android:id="@+id/email_edit_delete"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                style="@style/MinusButton" />
+        <HorizontalScrollView
+                android:id="@+id/email_types"
+                android:layout_width="160dip"
+                android:layout_height="wrap_content"
+                android:layout_marginLeft="60dip">
+            <LinearLayout
+                    android:layout_width="wrap_content"
+                    android:layout_height="wrap_content"
+                    android:orientation="horizontal">
+                <Button
+                        android:id="@+id/email_type_home"
+                        android:layout_width="80dip"
+                        android:layout_height="wrap_content" />
+                <Button
+                        android:id="@+id/email_type_work"
+                        android:layout_width="80dip"
+                        android:layout_height="wrap_content" />
+                <Button
+                        android:id="@+id/email_type_other"
+                        android:layout_width="80dip"
+                        android:layout_height="wrap_content" />
+                <Button
+                        android:id="@+id/email_type_custom"
+                        android:layout_width="80dip"
+                        android:layout_height="wrap_content" />
+            </LinearLayout>
+        </HorizontalScrollView>
+    </LinearLayout>
+
+    <LinearLayout
+        android:id="@+id/email_edit_custom_type"
+        android:layout_width="150dip"
+        android:layout_height="wrap_content"
+        android:orientation="vertical"
+        android:layout_alignParentRight="true">
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:text="@string/edit_email_type_caption"
+        />
+        <EditText
+            android:id="@+id/email_edit_type_text"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+        />
+    </LinearLayout>
+
+    <TextView
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingTop="5dip"
+        android:text="@string/edit_email_caption"
+    />
+    <EditText
+        android:id="@+id/email_edit_text"
+        android:layout_width="290dip"
+        android:layout_height="wrap_content"
+        android:inputType="textEmailAddress"
+        android:imeOptions="actionDone"
+    />
+
+    <LinearLayout
+        android:layout_width="290dip"
+        android:layout_height="wrap_content"
+        android:layout_marginTop="5dip"
+        android:orientation="horizontal"
+    >
+        <Button android:id="@+id/btn_ok"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:text="@android:string/ok"
+            android:layout_weight="1"
+        />
+        <Button android:id="@+id/btn_cancel"
+            android:layout_width="0dip"
+            android:layout_height="wrap_content"
+            android:text="@android:string/cancel"
+            android:layout_weight="1"
+        />
+    </LinearLayout>
+</LinearLayout>