Merge "Use "Add to contacts" as header for unknown numbers."
diff --git a/res/color/list_secondary_text_color.xml b/res/color/list_secondary_text_color.xml
deleted file mode 100644
index edf8678..0000000
--- a/res/color/list_secondary_text_color.xml
+++ /dev/null
@@ -1,22 +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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-
-    <item android:state_activated="true" android:color="@color/secondary_text_color_activated" />
-    <item android:color="@color/secondary_text_color" /> <!-- not selected -->
-
-</selector>
diff --git a/res/color/list_primary_text_color.xml b/res/color/primary_text_color.xml
similarity index 81%
copy from res/color/list_primary_text_color.xml
copy to res/color/primary_text_color.xml
index 7c185fc..acc2fb7 100644
--- a/res/color/list_primary_text_color.xml
+++ b/res/color/primary_text_color.xml
@@ -16,7 +16,7 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:state_activated="true" android:color="@color/primary_text_color_activated"/>
-    <item android:color="@color/primary_text_color" /> <!-- not selected -->
+    <item android:state_activated="true" android:color="#FFFFFF" />
+    <item android:color="#333333" /> <!-- not selected -->
 
 </selector>
diff --git a/res/color/list_primary_text_color.xml b/res/color/secondary_text_color.xml
similarity index 81%
rename from res/color/list_primary_text_color.xml
rename to res/color/secondary_text_color.xml
index 7c185fc..1c62458 100644
--- a/res/color/list_primary_text_color.xml
+++ b/res/color/secondary_text_color.xml
@@ -16,7 +16,7 @@
 
 <selector xmlns:android="http://schemas.android.com/apk/res/android">
 
-    <item android:state_activated="true" android:color="@color/primary_text_color_activated"/>
-    <item android:color="@color/primary_text_color" /> <!-- not selected -->
+    <item android:state_activated="true" android:color="#FFFFFF" />
+    <item android:color="#777777" /> <!-- not selected -->
 
 </selector>
diff --git a/res/drawable-sw580dp-hdpi/list_activated_holo.9.png b/res/drawable-sw580dp-hdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..046b24a
--- /dev/null
+++ b/res/drawable-sw580dp-hdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-sw580dp-mdpi/list_activated_holo.9.png b/res/drawable-sw580dp-mdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..1ff3373
--- /dev/null
+++ b/res/drawable-sw580dp-mdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/drawable-sw580dp-xhdpi/list_activated_holo.9.png b/res/drawable-sw580dp-xhdpi/list_activated_holo.9.png
new file mode 100644
index 0000000..2eb7c7e
--- /dev/null
+++ b/res/drawable-sw580dp-xhdpi/list_activated_holo.9.png
Binary files differ
diff --git a/res/layout/editor_account_header.xml b/res/layout/editor_account_header.xml
index b6b19db..ff33cf1 100644
--- a/res/layout/editor_account_header.xml
+++ b/res/layout/editor_account_header.xml
@@ -24,6 +24,7 @@
     android:orientation="horizontal"
     android:paddingTop="8dip"
     android:paddingBottom="8dip"
+    android:gravity="center_vertical"
     android:paddingLeft="@dimen/account_container_left_padding"
     android:paddingRight="32dip">
 
diff --git a/res/layout/editor_account_header_with_dropdown.xml b/res/layout/editor_account_header_with_dropdown.xml
index 74abee9..001eaae 100644
--- a/res/layout/editor_account_header_with_dropdown.xml
+++ b/res/layout/editor_account_header_with_dropdown.xml
@@ -22,6 +22,7 @@
     android:minHeight="48dip"
     android:background="#EEEEEE"
     android:orientation="horizontal"
+    android:gravity="center_vertical"
     android:paddingLeft="@dimen/account_container_left_padding"
     android:paddingRight="32dip">
 
diff --git a/res/layout/external_raw_contact_editor_view.xml b/res/layout/external_raw_contact_editor_view.xml
index a1e0754..f1ba198 100644
--- a/res/layout/external_raw_contact_editor_view.xml
+++ b/res/layout/external_raw_contact_editor_view.xml
@@ -40,8 +40,7 @@
             android:singleLine="true"
             android:ellipsize="end"
             android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textColor="?android:attr/textColorSecondary"
-            android:textStyle="bold"/>
+            android:textColor="?android:attr/textColorSecondary" />
 
         <LinearLayout
             android:id="@+id/stub_photo"
diff --git a/res/layout/group_browse_list_item.xml b/res/layout/group_browse_list_item.xml
index b213754..45f444f 100644
--- a/res/layout/group_browse_list_item.xml
+++ b/res/layout/group_browse_list_item.xml
@@ -71,7 +71,6 @@
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:textAppearance="?android:attr/textAppearanceMedium"
-                android:textColor="@color/list_primary_text_color"
                 android:ellipsize="end"
                 android:singleLine="true" />
 
@@ -80,7 +79,7 @@
                 android:layout_height="wrap_content"
                 android:layout_width="wrap_content"
                 android:textAppearance="?android:attr/textAppearanceSmall"
-                android:textColor="@color/list_secondary_text_color"
+                android:textColor="?android:attr/textColorSecondary"
                 android:ellipsize="end"
                 android:singleLine="true" />
 
diff --git a/res/layout/item_read_only_field.xml b/res/layout/item_read_only_field.xml
index 5f8367f..2765cfa 100644
--- a/res/layout/item_read_only_field.xml
+++ b/res/layout/item_read_only_field.xml
@@ -24,28 +24,39 @@
         android:id="@+id/kind_title_layout"
         layout="@layout/edit_kind_title" />
 
+    <!-- Shown only when id/kind_title_layout is hidden, dividing a previous item and this item. -->
+    <View
+        android:id="@+id/divider"
+        android:layout_width="match_parent"
+        android:layout_height="1px"
+        android:layout_marginLeft="8dip"
+        android:layout_marginRight="8dip"
+        android:background="?android:attr/listDivider" />
+
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:minHeight="@dimen/editor_min_line_item_height"
+        android:layout_marginLeft="16dip"
+        android:layout_marginRight="16dip"
         android:orientation="horizontal">
         <TextView
             android:id="@+id/data"
-            android:layout_width="wrap_content"
+            android:layout_width="0px"
             android:layout_height="wrap_content"
+            android:layout_weight="1"
             android:layout_gravity="center_vertical"
-            android:layout_marginLeft="16dip"
             android:textAppearance="?android:attr/textAppearanceMedium"
-            android:textColor="?android:attr/textColorPrimary"
+            android:textColor="?android:attr/textColorSecondary"
             android:singleLine="true"/>
         <TextView
             android:id="@+id/type"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_vertical"
-            android:layout_marginLeft="8dip"
             android:textAppearance="?android:attr/textAppearanceSmall"
             android:textColor="?android:attr/textColorSecondary"
+            android:textAllCaps="true"
             android:singleLine="true"/>
     </LinearLayout>
 
diff --git a/res/layout/stream_item_row_image_and_text.xml b/res/layout/stream_item_row_image_and_text.xml
index c5699f4..0ee6357 100644
--- a/res/layout/stream_item_row_image_and_text.xml
+++ b/res/layout/stream_item_row_image_and_text.xml
@@ -19,12 +19,13 @@
     xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginTop="@dimen/detail_update_section_between_items_padding"
     android:orientation="vertical">
 
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginBottom="8dip"
+        android:layout_marginBottom="@dimen/detail_update_section_between_items_padding"
         android:orientation="horizontal"
         android:weightSum="2">
 
@@ -33,7 +34,7 @@
             android:layout_width="0dip"
             android:layout_height="wrap_content"
             android:layout_weight="1"
-            android:layout_marginRight="@dimen/detail_update_section_between_items_horizontal_padding"
+            android:layout_marginRight="@dimen/detail_update_section_between_items_padding"
             ex:ratio="1"
             ex:direction="widthToHeight">
 
diff --git a/res/layout/stream_item_row_text_only.xml b/res/layout/stream_item_row_text_only.xml
index 919ee52..9d82edd 100644
--- a/res/layout/stream_item_row_text_only.xml
+++ b/res/layout/stream_item_row_text_only.xml
@@ -17,6 +17,7 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
+    android:layout_marginTop="@dimen/detail_update_section_between_items_padding"
     android:orientation="vertical">
 
     <TextView android:id="@+id/stream_item_html"
diff --git a/res/layout/stream_item_row_two_images.xml b/res/layout/stream_item_row_two_images.xml
index 3a524bf..7858f6f 100644
--- a/res/layout/stream_item_row_two_images.xml
+++ b/res/layout/stream_item_row_two_images.xml
@@ -18,13 +18,14 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:ex="http://schemas.android.com/apk/res/com.android.contacts"
     android:layout_width="match_parent"
-    android:layout_height="wrap_content">
+    android:layout_height="wrap_content"
+    android:layout_marginTop="@dimen/detail_update_section_between_items_padding">
 
     <view
         class="com.android.contacts.widget.ProportionalLayout"
         android:layout_width="0dip"
         android:layout_height="wrap_content"
-        android:layout_marginRight="@dimen/detail_update_section_between_items_horizontal_padding"
+        android:layout_marginRight="@dimen/detail_update_section_between_items_padding"
         android:layout_weight="1"
         ex:ratio="1"
         ex:direction="widthToHeight">
diff --git a/res/values/colors.xml b/res/values/colors.xml
index 5e8bd70..1a8ee23 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -80,19 +80,9 @@
     <!-- Color of the theme of the People app -->
     <color name="people_app_theme_color">#33B5E5</color>
 
-    <!-- Primary text color in the People app -->
-    <color name="primary_text_color">#333333</color>
-
-    <!-- Activated primary text color in the People app -->
-    <color name="primary_text_color_activated">#FFFFFF</color>
-
-    <!-- Secondary text color in the People app -->
-    <color name="secondary_text_color">#777777</color>
+    <!-- Secondary text color in the Phone app -->
     <color name="dialtacts_secondary_text_color">#888888</color>
 
-    <!-- Activated secondary text color in the People app -->
-    <color name="secondary_text_color_activated">#FFFFFF</color>
-
     <!-- Colors in the contact browser list -->
     <color name="contact_count_text_color">#AAAAAA</color>
 
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 13bb791..1c439d8 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -116,8 +116,8 @@
     <!-- Horizontal padding for individual stream items -->
     <dimen name="detail_update_section_item_horizontal_padding">8dip</dimen>
 
-    <!-- Horizontal padding between columns images and/or text in a single stream item -->
-    <dimen name="detail_update_section_between_items_horizontal_padding">16dip</dimen>
+    <!-- Padding between columns images and/or text in a single stream item -->
+    <dimen name="detail_update_section_between_items_padding">1dip</dimen>
 
     <!-- Horizontal padding between content sections within a stream item -->
     <dimen name="detail_update_section_internal_padding">16dip</dimen>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 43c4107..c22d1c6 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1808,4 +1808,7 @@
     <!-- Toast shown when the app starts showing all contacts regardless of its current
          contact filter state. [CHAR LIMIT=64] -->
     <string name="toast_displaying_all_contacts">Displaying all contacts</string>
+
+    <!-- Message in the standard "no account" prompt that encourages the user to add a Google account before continuing to use the People app [CHAR LIMIT=NONE] -->
+    <string name="no_account_prompt">People works better with a Google Account.\n\n\u2022 Access from any web browser.\n\u2022 Back up your contacts securely.</string>
 </resources>
diff --git a/src/com/android/contacts/editor/ExternalRawContactEditorView.java b/src/com/android/contacts/editor/ExternalRawContactEditorView.java
index e91cfcb..9b4f988 100644
--- a/src/com/android/contacts/editor/ExternalRawContactEditorView.java
+++ b/src/com/android/contacts/editor/ExternalRawContactEditorView.java
@@ -133,12 +133,14 @@
         mDataSet = values.getAsString(RawContacts.DATA_SET);
 
         if (isProfile) {
-            mAccountNameTextView.setVisibility(View.GONE);
             if (TextUtils.isEmpty(mAccountName)) {
+                mAccountNameTextView.setVisibility(View.GONE);
                 mAccountTypeTextView.setText(R.string.local_profile_title);
             } else {
-                mAccountTypeTextView.setText(
-                        mContext.getString(R.string.external_profile_title, mAccountName));
+                CharSequence accountType = type.getDisplayLabel(mContext);
+                mAccountTypeTextView.setText(mContext.getString(R.string.external_profile_title,
+                        accountType));
+                mAccountNameTextView.setText(mAccountName);
             }
         } else {
             CharSequence accountType = type.getDisplayLabel(mContext);
@@ -250,12 +252,15 @@
     private void bindData(
             CharSequence titleText, CharSequence data, CharSequence type, boolean isFirstEntry) {
         final View field = mInflater.inflate(R.layout.item_read_only_field, mGeneral, false);
+        final View divider = field.findViewById(R.id.divider);
         if (isFirstEntry) {
             final TextView titleView = (TextView) field.findViewById(R.id.kind_title);
             titleView.setText(titleText);
+            divider.setVisibility(View.GONE);
         } else {
             View titleContainer = field.findViewById(R.id.kind_title_layout);
             titleContainer.setVisibility(View.GONE);
+            divider.setVisibility(View.VISIBLE);
         }
         final TextView dataView = (TextView) field.findViewById(R.id.data);
         dataView.setText(data);
diff --git a/src/com/android/contacts/editor/RawContactEditorView.java b/src/com/android/contacts/editor/RawContactEditorView.java
index bac6217..118ca26 100644
--- a/src/com/android/contacts/editor/RawContactEditorView.java
+++ b/src/com/android/contacts/editor/RawContactEditorView.java
@@ -178,13 +178,15 @@
 
         // Fill in the account info
         if (isProfile) {
-            mAccountNameTextView.setVisibility(View.GONE);
             String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
             if (TextUtils.isEmpty(accountName)) {
+                mAccountNameTextView.setVisibility(View.GONE);
                 mAccountTypeTextView.setText(R.string.local_profile_title);
             } else {
-                mAccountTypeTextView.setText(
-                        mContext.getString(R.string.external_profile_title, accountName));
+                CharSequence accountType = type.getDisplayLabel(mContext);
+                mAccountTypeTextView.setText(mContext.getString(R.string.external_profile_title,
+                        accountType));
+                mAccountNameTextView.setText(accountName);
             }
         } else {
             String accountName = values.getAsString(RawContacts.ACCOUNT_NAME);
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
index 4b86295..7e0940f 100644
--- a/src/com/android/contacts/list/ContactListItemView.java
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -121,7 +121,6 @@
     private TextView mCountView;
     private ImageView mPresenceIcon;
 
-    private ColorStateList mPrimaryTextColor;
     private ColorStateList mSecondaryTextColor;
 
     private char[] mHighlightedPrefix;
@@ -252,8 +251,9 @@
                         Color.GREEN));
         a.recycle();
 
-        mPrimaryTextColor = getResources().getColorStateList(R.color.list_primary_text_color);
-        mSecondaryTextColor = getResources().getColorStateList(R.color.list_secondary_text_color);
+        a = getContext().obtainStyledAttributes(android.R.styleable.Theme);
+        mSecondaryTextColor = a.getColorStateList(android.R.styleable.Theme_textColorSecondary);
+        a.recycle();
 
         mHorizontalDividerHeight = mHorizontalDividerDrawable.getIntrinsicHeight();
 
@@ -766,7 +766,6 @@
             mNameTextView.setSingleLine(true);
             mNameTextView.setEllipsize(getTextEllipsis());
             mNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Medium);
-            mNameTextView.setTextColor(mPrimaryTextColor);
             // Manually call setActivated() since this view may be added after the first
             // setActivated() call toward this whole item view.
             mNameTextView.setActivated(isActivated());
@@ -826,7 +825,6 @@
             mPhoneticNameTextView.setEllipsize(getTextEllipsis());
             mPhoneticNameTextView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
             mPhoneticNameTextView.setTypeface(mPhoneticNameTextView.getTypeface(), Typeface.BOLD);
-            mPhoneticNameTextView.setTextColor(mPrimaryTextColor);
             mPhoneticNameTextView.setActivated(isActivated());
             addView(mPhoneticNameTextView);
         }
@@ -873,7 +871,6 @@
             mLabelView.setEllipsize(getTextEllipsis());
             mLabelView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
             mLabelView.setTypeface(mLabelView.getTypeface(), Typeface.BOLD);
-            mLabelView.setTextColor(mPrimaryTextColor);
             mLabelView.setActivated(isActivated());
             addView(mLabelView);
         }
@@ -905,7 +902,6 @@
             mDataView.setSingleLine(true);
             mDataView.setEllipsize(getTextEllipsis());
             mDataView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
-            mDataView.setTextColor(mPrimaryTextColor);
             mDataView.setActivated(isActivated());
             addView(mDataView);
         }
@@ -936,7 +932,6 @@
             mSnippetView.setEllipsize(getTextEllipsis());
             mSnippetView.setTextAppearance(mContext, android.R.style.TextAppearance_Small);
             mSnippetView.setTypeface(mSnippetView.getTypeface(), Typeface.BOLD);
-            mSnippetView.setTextColor(mPrimaryTextColor);
             mSnippetView.setActivated(isActivated());
             addView(mSnippetView);
         }
diff --git a/src/com/android/contacts/model/BaseAccountType.java b/src/com/android/contacts/model/BaseAccountType.java
index eee7241..dae09b2 100644
--- a/src/com/android/contacts/model/BaseAccountType.java
+++ b/src/com/android/contacts/model/BaseAccountType.java
@@ -65,7 +65,7 @@
     public BaseAccountType() {
         this.accountType = null;
         this.dataSet = null;
-        this.titleRes = R.string.local_profile_title;
+        this.titleRes = R.string.account_phone;
         this.iconRes = R.mipmap.ic_launcher_contacts;
     }
 
diff --git a/src/com/android/contacts/model/EntityDelta.java b/src/com/android/contacts/model/EntityDelta.java
index a045eb4..8244e9c 100644
--- a/src/com/android/contacts/model/EntityDelta.java
+++ b/src/com/android/contacts/model/EntityDelta.java
@@ -414,7 +414,14 @@
                 // Ignore children if parent was deleted
                 if (isContactDelete) continue;
 
-                builder = child.buildDiff(Data.CONTENT_URI);
+                // Use the profile data URI if the contact is the profile.
+                if (mContactsQueryUri.equals(Profile.CONTENT_RAW_CONTACTS_URI)) {
+                    builder = child.buildDiff(Uri.withAppendedPath(Profile.CONTENT_URI,
+                            RawContacts.Data.CONTENT_DIRECTORY));
+                } else {
+                    builder = child.buildDiff(Data.CONTENT_URI);
+                }
+
                 if (child.isInsert()) {
                     if (isContactInsert) {
                         // Parent is brand new insert, so back-reference _id
diff --git a/src/com/android/contacts/model/FallbackAccountType.java b/src/com/android/contacts/model/FallbackAccountType.java
index a40828e..8bb3992 100644
--- a/src/com/android/contacts/model/FallbackAccountType.java
+++ b/src/com/android/contacts/model/FallbackAccountType.java
@@ -25,7 +25,7 @@
     public FallbackAccountType(Context context) {
         this.accountType = null;
         this.dataSet = null;
-        this.titleRes = R.string.local_profile_title;
+        this.titleRes = R.string.account_phone;
         this.iconRes = R.mipmap.ic_launcher_contacts;
 
         this.resPackageName = null;