Merge "Showing phonetic name in the contact header."
diff --git a/core/java/com/android/internal/widget/ContactHeaderWidget.java b/core/java/com/android/internal/widget/ContactHeaderWidget.java
index c4f9988..242f12e 100644
--- a/core/java/com/android/internal/widget/ContactHeaderWidget.java
+++ b/core/java/com/android/internal/widget/ContactHeaderWidget.java
@@ -99,6 +99,7 @@
             Contacts.LOOKUP_KEY,
             Contacts.PHOTO_ID,
             Contacts.DISPLAY_NAME,
+            Contacts.PHONETIC_NAME,
             Contacts.STARRED,
             Contacts.CONTACT_PRESENCE,
             Contacts.CONTACT_STATUS,
@@ -110,14 +111,15 @@
         int LOOKUP_KEY = 1;
         int PHOTO_ID = 2;
         int DISPLAY_NAME = 3;
+        int PHONETIC_NAME = 4;
         //TODO: We need to figure out how we're going to get the phonetic name.
         //static final int HEADER_PHONETIC_NAME_COLUMN_INDEX
-        int STARRED = 4;
-        int CONTACT_PRESENCE_STATUS = 5;
-        int CONTACT_STATUS = 6;
-        int CONTACT_STATUS_TIMESTAMP = 7;
-        int CONTACT_STATUS_RES_PACKAGE = 8;
-        int CONTACT_STATUS_LABEL = 9;
+        int STARRED = 5;
+        int CONTACT_PRESENCE_STATUS = 6;
+        int CONTACT_STATUS = 7;
+        int CONTACT_STATUS_TIMESTAMP = 8;
+        int CONTACT_STATUS_RES_PACKAGE = 9;
+        int CONTACT_STATUS_LABEL = 10;
     }
 
     private interface PhotoQuery {
@@ -321,7 +323,7 @@
     }
 
     /**
-     * Turn on/off showing of the aggregate bage element.
+     * Turn on/off showing of the aggregate badge element.
      */
     public void showAggregateBadge(boolean showBagde) {
         mAggregateBadge.setVisibility(showBagde ? View.VISIBLE : View.GONE);
@@ -380,8 +382,11 @@
      */
     public void setDisplayName(CharSequence displayName, CharSequence phoneticName) {
         mDisplayNameView.setText(displayName);
-        if (mPhoneticNameView != null) {
+        if (!TextUtils.isEmpty(phoneticName)) {
             mPhoneticNameView.setText(phoneticName);
+            mPhoneticNameView.setVisibility(View.VISIBLE);
+        } else {
+            mPhoneticNameView.setVisibility(View.GONE);
         }
     }
 
@@ -524,10 +529,9 @@
      * Bind the contact details provided by the given {@link Cursor}.
      */
     protected void bindContactInfo(Cursor c) {
-        // TODO: Bring back phonetic name
         final String displayName = c.getString(ContactQuery.DISPLAY_NAME);
-        final String phoneticName = null;
-        this.setDisplayName(displayName, null);
+        final String phoneticName = c.getString(ContactQuery.PHONETIC_NAME);
+        this.setDisplayName(displayName, phoneticName);
 
         final boolean starred = c.getInt(ContactQuery.STARRED) != 0;
         mStarredView.setChecked(starred);
diff --git a/core/res/res/layout-ja/contact_header_name.xml b/core/res/res/layout-ja/contact_header_name.xml
deleted file mode 100644
index 39d5593..0000000
--- a/core/res/res/layout-ja/contact_header_name.xml
+++ /dev/null
@@ -1,44 +0,0 @@
-<?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.
--->
-
-<!-- In Japanese-language locales, the "Name" field contains two separate
-     TextViews: the name itself, and also the phonetic ("furigana") field. -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:orientation="vertical"
-    android:layout_width="0dip"
-    android:layout_weight="1"
-    android:layout_height="match_parent">
-
-    <TextView android:id="@+id/name"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:singleLine="true"
-        android:ellipsize="end"
-        android:textAppearance="?android:attr/textAppearanceMedium"
-        android:textStyle="bold"
-        android:shadowColor="#BB000000"
-        android:shadowRadius="2.75"
-        />
-
-    <TextView android:id="@+id/phonetic_name"
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:singleLine="true"
-        android:ellipsize="end"
-        android:textAppearance="?android:attr/textAppearanceSmall"
-        />
-
-</LinearLayout>
diff --git a/core/res/res/layout/contact_header.xml b/core/res/res/layout/contact_header.xml
index e5b6c35..ecbe41b 100644
--- a/core/res/res/layout/contact_header.xml
+++ b/core/res/res/layout/contact_header.xml
@@ -50,18 +50,35 @@
                 android:src="@drawable/ic_aggregated"
             />
 
-            <!-- "Name" field is locale-specific. -->
-            <include layout="@layout/contact_header_name"/>
-
+            <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"
+                android:layout_marginBottom="-4dip"
+                />
         </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"
+        />
+
         <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="-4dip"
+            android:layout_marginTop="-2dip"
         />
 
         <TextView android:id="@+id/status_date"
diff --git a/core/res/res/layout/contact_header_name.xml b/core/res/res/layout/contact_header_name.xml
deleted file mode 100644
index 24db2f2..0000000
--- a/core/res/res/layout/contact_header_name.xml
+++ /dev/null
@@ -1,29 +0,0 @@
-<?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.
--->
-
-<!-- In the default locale, the "Name" field is a single TextView -->
-<TextView xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/name"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:textAppearance="?android:attr/textAppearanceMedium"
-    android:textStyle="bold"
-    android:singleLine="true"
-    android:ellipsize="end"
-    android:layout_gravity="center_vertical"
-    android:shadowColor="#BB000000"
-    android:shadowRadius="2.75"
-    />