Contact editor fixes

- Bring back data kind titles
- "Delete" button should be invisible not gone
- Make field + spinner horizontally stacked instead of vertically
stacked on phone
- Don't show account header if editing an existing contact that
only consists of 1 raw contact

Change-Id: I7dd4bfdf273eeaccca8399d182c0a56a6e23a8c7
diff --git a/res/layout-sw580dp/event_field_editor_view.xml b/res/layout-sw580dp/event_field_editor_view.xml
index c9eef08..f31b283 100644
--- a/res/layout-sw580dp/event_field_editor_view.xml
+++ b/res/layout-sw580dp/event_field_editor_view.xml
@@ -23,10 +23,6 @@
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:orientation="vertical">
 
-    <include
-        android:id="@+id/title"
-        layout="@layout/edit_field_title" />
-
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
diff --git a/res/layout-sw580dp/item_kind_section.xml b/res/layout-sw580dp/item_kind_section.xml
index dd38e26..31538bb 100644
--- a/res/layout-sw580dp/item_kind_section.xml
+++ b/res/layout-sw580dp/item_kind_section.xml
@@ -22,11 +22,9 @@
     android:layout_height="wrap_content"
     android:paddingBottom="@dimen/editor_field_bottom_padding"
     android:orientation="vertical">
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:scaleType="fitXY"
-        android:src="@drawable/divider_horizontal_light" />
+
+    <include
+        layout="@layout/edit_kind_title" />
 
     <LinearLayout
         android:id="@+id/kind_editors"
diff --git a/res/layout-sw580dp/text_fields_editor_view.xml b/res/layout-sw580dp/text_fields_editor_view.xml
index 8be354b..be0ea67 100644
--- a/res/layout-sw580dp/text_fields_editor_view.xml
+++ b/res/layout-sw580dp/text_fields_editor_view.xml
@@ -21,10 +21,6 @@
     android:minHeight="?android:attr/listPreferredItemHeight"
     android:orientation="vertical">
 
-    <include
-        android:id="@+id/title"
-        layout="@layout/edit_field_title" />
-
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
diff --git a/res/layout/edit_field_title.xml b/res/layout/edit_field_title.xml
deleted file mode 100644
index 4918c4d..0000000
--- a/res/layout/edit_field_title.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 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.
--->
-
-<!-- Title of a field in the contact editor. -->
-
-<TextView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/title"
-    android:layout_width="wrap_content"
-    android:layout_height="wrap_content"
-    android:paddingTop="@dimen/editor_field_top_padding"
-    android:paddingLeft="@dimen/editor_field_left_padding"
-    android:textAppearance="?android:attr/textAppearanceMedium"
-    android:singleLine="true"
-    android:ellipsize="marquee"
-    android:fadingEdge="horizontal" />
\ No newline at end of file
diff --git a/res/layout/edit_kind_title.xml b/res/layout/edit_kind_title.xml
new file mode 100644
index 0000000..619ba49
--- /dev/null
+++ b/res/layout/edit_kind_title.xml
@@ -0,0 +1,48 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+/*
+ * Copyright 2011, 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="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingLeft="@dimen/editor_field_left_padding"
+    android:paddingRight="@dimen/editor_field_right_padding"
+    android:orientation="vertical">
+
+    <TextView
+        android:id="@+id/kind_title"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:paddingLeft="@dimen/editor_field_left_padding"
+        android:textAppearance="?android:attr/textAppearanceMedium"
+        android:textColor="@color/people_app_theme_color"
+        android:textStyle="bold"
+        android:singleLine="true"
+        android:ellipsize="end"
+        android:paddingTop="5dip"
+        android:paddingBottom="2dip" />
+
+    <ImageView
+        android:id="@+id/divider"
+        android:layout_width="match_parent"
+        android:layout_height="2dip"
+        android:scaleType="fitXY"
+        android:src="@color/people_app_theme_color"/>
+
+</LinearLayout>
diff --git a/res/layout/edit_spinner.xml b/res/layout/edit_spinner.xml
index 9e22ee7..3896702 100644
--- a/res/layout/edit_spinner.xml
+++ b/res/layout/edit_spinner.xml
@@ -16,11 +16,12 @@
 
 <!-- Spinner for a field in the contact editor. -->
 
+<!-- Note: explicitly override the default left and right padding on spinner -->
 <Spinner
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/spinner"
-    android:layout_width="wrap_content"
+    android:layout_width="@dimen/editor_type_label_width"
     android:layout_height="wrap_content"
-    android:layout_marginLeft="@dimen/editor_field_left_padding"
-    android:textAppearance="?android:attr/textAppearanceLarge"
-    android:paddingLeft="5dip"/>
\ No newline at end of file
+    android:paddingLeft="5dip"
+    android:paddingRight="0dip"
+    android:textAppearance="?android:attr/textAppearanceSmall"/>
\ No newline at end of file
diff --git a/res/layout/event_field_editor_view.xml b/res/layout/event_field_editor_view.xml
index 6625279..0dceafc 100644
--- a/res/layout/event_field_editor_view.xml
+++ b/res/layout/event_field_editor_view.xml
@@ -22,15 +22,6 @@
     android:layout_height="wrap_content"
     android:orientation="vertical">
 
-    <include
-        android:id="@+id/title"
-        layout="@layout/edit_field_title" />
-
-    <include
-        android:id="@+id/spinner"
-        layout="@layout/edit_spinner"
-        android:visibility="gone" />
-
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
@@ -45,6 +36,11 @@
             layout="@layout/edit_date_picker" />
 
         <include
+            android:id="@+id/spinner"
+            layout="@layout/edit_spinner"
+            android:visibility="gone" />
+
+        <include
             android:id="@+id/delete_button_container"
             layout="@layout/edit_delete_button"
             android:visibility="gone" />
diff --git a/res/layout/item_group_membership.xml b/res/layout/item_group_membership.xml
index 13ddb20..62d06ea 100644
--- a/res/layout/item_group_membership.xml
+++ b/res/layout/item_group_membership.xml
@@ -20,15 +20,8 @@
     android:layout_height="wrap_content"
     android:orientation="vertical">
 
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:scaleType="fitXY"
-        android:src="@drawable/divider_horizontal_light" />
-
     <include
-        android:id="@+id/kind_title"
-        layout="@layout/edit_field_title" />
+        layout="@layout/edit_kind_title" />
 
     <Button
         style="?android:attr/spinnerStyle"
@@ -41,7 +34,6 @@
         android:gravity="left|center_vertical"
         android:ellipsize="end"
         android:focusable="true"
-        android:paddingLeft="@dimen/editor_field_left_padding"
-    />
+        android:paddingLeft="@dimen/editor_field_left_padding" />
 
 </com.android.contacts.editor.GroupMembershipView>
diff --git a/res/layout/item_kind_section.xml b/res/layout/item_kind_section.xml
index 2c6dc6f..edc9d37 100644
--- a/res/layout/item_kind_section.xml
+++ b/res/layout/item_kind_section.xml
@@ -23,11 +23,8 @@
     android:paddingBottom="@dimen/editor_field_bottom_padding"
     android:orientation="vertical">
 
-    <ImageView
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:scaleType="fitXY"
-        android:src="@drawable/divider_horizontal_light" />
+    <include
+        layout="@layout/edit_kind_title" />
 
     <LinearLayout
         android:id="@+id/kind_editors"
diff --git a/res/layout/text_fields_editor_view.xml b/res/layout/text_fields_editor_view.xml
index d33e804..c8d35a4 100644
--- a/res/layout/text_fields_editor_view.xml
+++ b/res/layout/text_fields_editor_view.xml
@@ -20,15 +20,6 @@
     android:layout_height="wrap_content"
     android:orientation="vertical">
 
-    <include
-        android:id="@+id/title"
-        layout="@layout/edit_field_title" />
-
-    <include
-        android:id="@+id/spinner"
-        layout="@layout/edit_spinner"
-        android:visibility="gone" />
-
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
@@ -43,6 +34,11 @@
             layout="@layout/edit_field_list" />
 
         <include
+            android:id="@+id/spinner"
+            layout="@layout/edit_spinner"
+            android:visibility="gone" />
+
+        <include
             android:id="@+id/expansion_view_container"
             layout="@layout/edit_expansion_view"
             android:visibility="gone" />
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 0d868e9..3199799 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -45,7 +45,7 @@
     <dimen name="editor_round_button_padding_bottom">8dip</dimen>
 
     <!-- Width of the Type-Label in the Editor -->
-    <dimen name="editor_type_label_width">120dip</dimen>
+    <dimen name="editor_type_label_width">100dip</dimen>
 
     <!-- Left padding of a field in the Editor -->
     <dimen name="editor_field_left_padding">5dip</dimen>