Merge "Use new "deferred fragments" feature on People" into ics-mr1
diff --git a/res/layout-sw580dp/group_editor_view.xml b/res/layout-sw580dp/group_editor_view.xml
index a16c240..76c05d4 100644
--- a/res/layout-sw580dp/group_editor_view.xml
+++ b/res/layout-sw580dp/group_editor_view.xml
@@ -18,9 +18,9 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:paddingTop="50dip"
-    android:paddingLeft="64dip"
-    android:paddingRight="64dip"
+    android:paddingTop="32dip"
+    android:paddingLeft="@dimen/group_editor_side_padding"
+    android:paddingRight="@dimen/group_editor_side_padding"
     android:orientation="horizontal"
     android:background="@color/background_primary">
 
diff --git a/res/layout-sw580dp/quickcontact_activity.xml b/res/layout-sw580dp/quickcontact_activity.xml
index 8c8bfae..ba9c9ab 100644
--- a/res/layout-sw580dp/quickcontact_activity.xml
+++ b/res/layout-sw580dp/quickcontact_activity.xml
@@ -29,7 +29,7 @@
         android:orientation="vertical">
         <FrameLayout
             android:layout_width="400dip"
-            android:layout_height="200dip">
+            android:layout_height="@dimen/quick_contact_photo_container_height">
             <include layout="@layout/quickcontact_photo_container" />
         </FrameLayout>
         <include layout="@layout/quickcontact_track" />
@@ -41,6 +41,6 @@
         <android.support.v4.view.ViewPager
             android:id="@+id/item_list_pager"
             android:layout_width="match_parent"
-            android:layout_height="180dip" />
+            android:layout_height="160dip" />
     </LinearLayout>
 </view>
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_container.xml b/res/layout-sw680dp-w1000dp/contact_detail_container.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/contact_detail_container.xml
rename to res/layout-sw680dp-w1000dp/contact_detail_container.xml
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_empty.xml b/res/layout-sw680dp-w1000dp/contact_detail_empty.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/contact_detail_empty.xml
rename to res/layout-sw680dp-w1000dp/contact_detail_empty.xml
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_fragment.xml b/res/layout-sw680dp-w1000dp/contact_detail_fragment.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/contact_detail_fragment.xml
rename to res/layout-sw680dp-w1000dp/contact_detail_fragment.xml
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_list_item.xml b/res/layout-sw680dp-w1000dp/contact_detail_list_item.xml
similarity index 98%
rename from res/layout-sw580dp-w1000dp/contact_detail_list_item.xml
rename to res/layout-sw680dp-w1000dp/contact_detail_list_item.xml
index ffde8b0..ccecc35 100644
--- a/res/layout-sw580dp-w1000dp/contact_detail_list_item.xml
+++ b/res/layout-sw680dp-w1000dp/contact_detail_list_item.xml
@@ -76,6 +76,15 @@
             android:layout_gravity="center_vertical"
             android:visibility="gone" />
 
+        <View
+            android:id="@+id/primary_indicator"
+            android:layout_width="16dip"
+            android:layout_height="16dip"
+            android:visibility="gone"
+            android:layout_gravity="center_vertical"
+            android:background="@drawable/ic_list_default_mime_holo_dark"
+            android:layout_marginRight="8dip" />
+
         <TextView
             android:id="@+id/type"
             style="@style/ContactDetailItemType"
@@ -85,14 +94,6 @@
             android:paddingRight="16dip" />
 
         <View
-            android:id="@+id/primary_indicator"
-            android:layout_width="16dip"
-            android:layout_height="16dip"
-            android:visibility="gone"
-            android:layout_gravity="center_vertical"
-            android:background="@drawable/ic_list_default_mime_holo_dark" />
-
-        <View
             android:id="@+id/vertical_divider"
             android:layout_width="1px"
             android:layout_height="match_parent"
diff --git a/res/layout-sw580dp-w1000dp/contact_detail_updates_fragment.xml b/res/layout-sw680dp-w1000dp/contact_detail_updates_fragment.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/contact_detail_updates_fragment.xml
rename to res/layout-sw680dp-w1000dp/contact_detail_updates_fragment.xml
diff --git a/res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml b/res/layout-sw680dp-w1000dp/detail_header_contact_with_updates.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/detail_header_contact_with_updates.xml
rename to res/layout-sw680dp-w1000dp/detail_header_contact_with_updates.xml
diff --git a/res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml b/res/layout-sw680dp-w1000dp/detail_header_contact_without_updates.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/detail_header_contact_without_updates.xml
rename to res/layout-sw680dp-w1000dp/detail_header_contact_without_updates.xml
diff --git a/res/layout-sw580dp-w1000dp/people_activity.xml b/res/layout-sw680dp-w1000dp/people_activity.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/people_activity.xml
rename to res/layout-sw680dp-w1000dp/people_activity.xml
diff --git a/res/layout-sw580dp-w1000dp/updates_header_contact.xml b/res/layout-sw680dp-w1000dp/updates_header_contact.xml
similarity index 100%
rename from res/layout-sw580dp-w1000dp/updates_header_contact.xml
rename to res/layout-sw680dp-w1000dp/updates_header_contact.xml
diff --git a/res/layout/carousel_updates_tab.xml b/res/layout/carousel_updates_tab.xml
index d471d93..d23f650 100644
--- a/res/layout/carousel_updates_tab.xml
+++ b/res/layout/carousel_updates_tab.xml
@@ -56,7 +56,8 @@
         android:textAppearance="?android:attr/textAppearanceLarge"
         android:textColor="@color/detail_update_tab_text_color"
         android:textStyle="bold"
-        android:maxLines="@integer/updates_tab_snippet_max_lines"/>
+        android:maxLines="@integer/updates_tab_snippet_max_lines"
+        android:ellipsize="end" />
 
     <View
         android:id="@+id/alpha_overlay"
diff --git a/res/layout/raw_contact_readonly_editor_view.xml b/res/layout/raw_contact_readonly_editor_view.xml
index b34028a..aa7d705 100644
--- a/res/layout/raw_contact_readonly_editor_view.xml
+++ b/res/layout/raw_contact_readonly_editor_view.xml
@@ -19,6 +19,7 @@
     android:layout_width="match_parent"
     android:layout_height="wrap_content"
     android:orientation="vertical"
+    android:paddingTop="@dimen/editor_padding_top"
     android:paddingBottom="32dip">
 
     <include
diff --git a/res/values-sw580dp-w1000dp-port/dimens.xml b/res/values-sw580dp-w1000dp-port/dimens.xml
deleted file mode 100644
index 767fda4..0000000
--- a/res/values-sw580dp-w1000dp-port/dimens.xml
+++ /dev/null
@@ -1,18 +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.
--->
-<resources>
-    <dimen name="contact_detail_list_top_padding">8dip</dimen>
-</resources>
diff --git a/res/values-sw580dp-w1000dp/dimens.xml b/res/values-sw580dp-w1000dp/dimens.xml
index 940e456..1cbc395 100644
--- a/res/values-sw580dp-w1000dp/dimens.xml
+++ b/res/values-sw580dp-w1000dp/dimens.xml
@@ -14,9 +14,5 @@
      limitations under the License.
 -->
 <resources>
-    <dimen name="group_detail_border_padding">32dip</dimen>
-    <dimen name="group_detail_side_margin">32dip</dimen>
-    <dimen name="detail_contact_photo_margin">16dip</dimen>
-    <dimen name="contact_detail_list_top_padding">32dip</dimen>
-    <dimen name="contact_tile_list_padding_top">32dip</dimen>
+    <dimen name="group_editor_side_padding">64dip</dimen>
 </resources>
diff --git a/res/values-sw580dp-w1000dp/integers.xml b/res/values-sw580dp-w1000dp/integers.xml
index 5fda2ed..c09a1f3 100644
--- a/res/values-sw580dp-w1000dp/integers.xml
+++ b/res/values-sw580dp-w1000dp/integers.xml
@@ -14,5 +14,5 @@
      limitations under the License.
 -->
 <resources>
-    <integer name="contact_tile_column_count">4</integer>
-</resources>
\ No newline at end of file
+    <integer name="updates_tab_snippet_max_lines">7</integer>
+</resources>
diff --git a/res/values-sw580dp/integers.xml b/res/values-sw580dp/integers.xml
index 56e837e..a62fa14 100644
--- a/res/values-sw580dp/integers.xml
+++ b/res/values-sw580dp/integers.xml
@@ -15,5 +15,5 @@
 -->
 <resources>
     <integer name="contact_tile_column_count">2</integer>
-    <integer name="updates_tab_snippet_max_lines">5</integer>
+    <integer name="updates_tab_snippet_max_lines">4</integer>
 </resources>
diff --git a/res/values-sw580dp-w720dp/integers.xml b/res/values-sw680dp-w1000dp/dimens.xml
similarity index 65%
copy from res/values-sw580dp-w720dp/integers.xml
copy to res/values-sw680dp-w1000dp/dimens.xml
index c629f7e..e492e5b 100644
--- a/res/values-sw580dp-w720dp/integers.xml
+++ b/res/values-sw680dp-w1000dp/dimens.xml
@@ -14,5 +14,10 @@
      limitations under the License.
 -->
 <resources>
-    <integer name="contact_tile_column_count">2</integer>
+    <dimen name="group_detail_border_padding">32dip</dimen>
+    <dimen name="group_detail_side_margin">32dip</dimen>
+    <dimen name="group_editor_side_padding">64dip</dimen>
+    <dimen name="detail_contact_photo_margin">16dip</dimen>
+    <dimen name="contact_detail_list_top_padding">32dip</dimen>
+    <dimen name="contact_tile_list_padding_top">32dip</dimen>
 </resources>
diff --git a/res/values-sw580dp-w720dp/integers.xml b/res/values-sw680dp-w1000dp/integers.xml
similarity index 91%
copy from res/values-sw580dp-w720dp/integers.xml
copy to res/values-sw680dp-w1000dp/integers.xml
index c629f7e..5fda2ed 100644
--- a/res/values-sw580dp-w720dp/integers.xml
+++ b/res/values-sw680dp-w1000dp/integers.xml
@@ -14,5 +14,5 @@
      limitations under the License.
 -->
 <resources>
-    <integer name="contact_tile_column_count">2</integer>
-</resources>
+    <integer name="contact_tile_column_count">4</integer>
+</resources>
\ No newline at end of file
diff --git a/res/values-sw580dp-w1000dp/styles.xml b/res/values-sw680dp-w1000dp/styles.xml
similarity index 100%
rename from res/values-sw580dp-w1000dp/styles.xml
rename to res/values-sw680dp-w1000dp/styles.xml
diff --git a/res/values-sw580dp-w720dp/dimens.xml b/res/values-sw680dp/dimens.xml
similarity index 87%
rename from res/values-sw580dp-w720dp/dimens.xml
rename to res/values-sw680dp/dimens.xml
index a69c20a..0876995 100644
--- a/res/values-sw580dp-w720dp/dimens.xml
+++ b/res/values-sw680dp/dimens.xml
@@ -17,4 +17,6 @@
     <dimen name="editor_type_label_width">180dip</dimen>
     <dimen name="editor_round_button_padding_left">8dip</dimen>
     <dimen name="editor_round_button_padding_right">8dip</dimen>
+    <dimen name="group_editor_side_padding">16dip</dimen>
+    <dimen name="quick_contact_photo_container_height">400dip</dimen>
 </resources>
diff --git a/res/values-sw580dp-w720dp/integers.xml b/res/values-sw680dp/integers.xml
similarity index 92%
rename from res/values-sw580dp-w720dp/integers.xml
rename to res/values-sw680dp/integers.xml
index c629f7e..eaf5971 100644
--- a/res/values-sw580dp-w720dp/integers.xml
+++ b/res/values-sw680dp/integers.xml
@@ -15,4 +15,5 @@
 -->
 <resources>
     <integer name="contact_tile_column_count">2</integer>
+    <integer name="updates_tab_snippet_max_lines">7</integer>
 </resources>
diff --git a/res/values-sw580dp-w720dp/styles.xml b/res/values-sw680dp/styles.xml
similarity index 100%
rename from res/values-sw580dp-w720dp/styles.xml
rename to res/values-sw680dp/styles.xml
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 89122ca..9f5766e 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -131,6 +131,9 @@
     <!-- Left padding for a group member list item -->
     <dimen name="group_member_item_left_padding">4dip</dimen>
 
+    <!-- Left and right padding for the group editor view -->
+    <dimen name="group_editor_side_padding">16dip</dimen>
+
     <!-- Left margin for the group member list to match the built in margin in the autocomplete asset -->
     <dimen name="group_editor_member_list_left_margin">4dip</dimen>
 
@@ -146,6 +149,9 @@
     <!-- Left and right margin for the divider in the group detail fragment -->
     <dimen name="group_detail_side_margin">0dip</dimen>
 
+    <!-- Height of the quick contact photo container (for screens that are too large to use the screen width/height as a constraint)-->
+    <dimen name="quick_contact_photo_container_height">200dip</dimen>
+
     <!-- Height of edit text in dialpad fragment -->
     <dimen name="dialpad_horizontal_margin">0dip</dimen>
     <dimen name="dialpad_vertical_margin">2dip</dimen>
diff --git a/src/com/android/contacts/ContactsUtils.java b/src/com/android/contacts/ContactsUtils.java
index 64dfaef..cb19713 100644
--- a/src/com/android/contacts/ContactsUtils.java
+++ b/src/com/android/contacts/ContactsUtils.java
@@ -24,6 +24,7 @@
 
 import android.content.Context;
 import android.content.Intent;
+import android.graphics.Rect;
 import android.location.CountryDetector;
 import android.net.Uri;
 import android.provider.ContactsContract;
@@ -221,4 +222,22 @@
         textView.setText(context.getString(textResourceId));
         return view;
     }
+
+    /**
+     * Returns the {@link Rect} with left, top, right, and bottom coordinates
+     * that are equivalent to the given {@link View}'s bounds. This is equivalent to how the
+     * target {@link Rect} is calculated in {@link QuickContact#showQuickContact}.
+     */
+    public static Rect getTargetRectFromView(Context context, View view) {
+        final float appScale = context.getResources().getCompatibilityInfo().applicationScale;
+        final int[] pos = new int[2];
+        view.getLocationOnScreen(pos);
+
+        final Rect rect = new Rect();
+        rect.left = (int) (pos[0] * appScale + 0.5f);
+        rect.top = (int) (pos[1] * appScale + 0.5f);
+        rect.right = (int) ((pos[0] + view.getWidth()) * appScale + 0.5f);
+        rect.bottom = (int) ((pos[1] + view.getHeight()) * appScale + 0.5f);
+        return rect;
+    }
 }
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 12f7e8c..031f0c8 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -68,6 +68,7 @@
 import android.content.ActivityNotFoundException;
 import android.content.ContentValues;
 import android.content.Intent;
+import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Bundle;
 import android.os.Handler;
@@ -77,6 +78,7 @@
 import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.Intents;
 import android.provider.ContactsContract.ProviderStatus;
+import android.provider.ContactsContract.QuickContact;
 import android.provider.Settings;
 import android.support.v13.app.FragmentPagerAdapter;
 import android.support.v4.view.PagerAdapter;
@@ -1161,9 +1163,9 @@
     private final class StrequentContactListFragmentListener
             implements ContactTileListFragment.Listener {
         @Override
-        public void onContactSelected(Uri contactUri) {
+        public void onContactSelected(Uri contactUri, Rect targetRect) {
             if (PhoneCapabilityTester.isUsingTwoPanes(PeopleActivity.this)) {
-                setupContactDetailFragment(contactUri);
+                QuickContact.showQuickContact(PeopleActivity.this, targetRect, contactUri, 0, null);
             } else {
                 startActivity(new Intent(Intent.ACTION_VIEW, contactUri));
             }
diff --git a/src/com/android/contacts/group/GroupDetailFragment.java b/src/com/android/contacts/group/GroupDetailFragment.java
index b3472ab..c856594 100644
--- a/src/com/android/contacts/group/GroupDetailFragment.java
+++ b/src/com/android/contacts/group/GroupDetailFragment.java
@@ -37,6 +37,7 @@
 import android.content.Loader;
 import android.content.res.Resources;
 import android.database.Cursor;
+import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Bundle;
 import android.provider.ContactsContract.Groups;
@@ -208,7 +209,7 @@
             new ContactTileAdapter.Listener() {
 
         @Override
-        public void onContactSelected(Uri contactUri) {
+        public void onContactSelected(Uri contactUri, Rect targetRect) {
             mListener.onContactSelected(contactUri);
         }
     };
diff --git a/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java b/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java
deleted file mode 100644
index 135fbc6..0000000
--- a/src/com/android/contacts/list/ContactBrowseListContextMenuAdapter.java
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
- * Copyright (C) 2010 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.
- */
-package com.android.contacts.list;
-
-import com.android.contacts.R;
-import com.android.contacts.util.PhoneCapabilityTester;
-import com.android.contacts.widget.ContextMenuAdapter;
-
-import android.content.Context;
-import android.net.Uri;
-import android.util.Log;
-import android.view.ContextMenu;
-import android.view.MenuItem;
-import android.view.View;
-import android.view.ContextMenu.ContextMenuInfo;
-import android.widget.AdapterView;
-
-/**
- * A contextual menu adapter for the basic contact list.
- *
- * TODO Not used any more.  Remove it.
- */
-public class ContactBrowseListContextMenuAdapter implements ContextMenuAdapter {
-
-    private static final int MENU_ITEM_VIEW_CONTACT = 1;
-    private static final int MENU_ITEM_CALL = 2;
-    private static final int MENU_ITEM_SEND_SMS = 3;
-    private static final int MENU_ITEM_EDIT = 4;
-    private static final int MENU_ITEM_DELETE = 5;
-    private static final int MENU_ITEM_TOGGLE_STAR = 6;
-
-    private static final String TAG = "LightContactBrowserContextMenuAdapter";
-
-    private final ContactBrowseListFragment mContactListFragment;
-
-    public ContactBrowseListContextMenuAdapter(ContactBrowseListFragment fragment) {
-        this.mContactListFragment = fragment;
-    }
-
-    @Override
-    public void onCreateContextMenu(ContextMenu menu, View view, ContextMenuInfo menuInfo) {
-        AdapterView.AdapterContextMenuInfo info;
-        try {
-             info = (AdapterView.AdapterContextMenuInfo) menuInfo;
-        } catch (ClassCastException e) {
-            Log.wtf(TAG, "Bad menuInfo", e);
-            return;
-        }
-
-        ContactListAdapter adapter = mContactListFragment.getAdapter();
-        int headerViewsCount = mContactListFragment.getListView().getHeaderViewsCount();
-        int position = info.position - headerViewsCount;
-
-        // Setup the menu header
-        menu.setHeaderTitle(adapter.getContactDisplayName(position));
-
-        // View contact details
-        menu.add(0, MENU_ITEM_VIEW_CONTACT, 0, R.string.menu_viewContact);
-
-        if (adapter.getHasPhoneNumber(position)) {
-            final Context context = mContactListFragment.getContext();
-            boolean hasPhoneApp = PhoneCapabilityTester.isPhone(context);
-            boolean hasSmsApp = PhoneCapabilityTester.isSmsIntentRegistered(context);
-            // Calling contact
-            if (hasPhoneApp) menu.add(0, MENU_ITEM_CALL, 0, R.string.menu_call);
-            // Send SMS item
-            if (hasSmsApp) menu.add(0, MENU_ITEM_SEND_SMS, 0, R.string.menu_sendSMS);
-        }
-
-        // Star toggling
-        if (!adapter.isContactStarred(position)) {
-            menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_addStar);
-        } else {
-            menu.add(0, MENU_ITEM_TOGGLE_STAR, 0, R.string.menu_removeStar);
-        }
-
-        // Contact editing
-        menu.add(0, MENU_ITEM_EDIT, 0, R.string.menu_editContact);
-        menu.add(0, MENU_ITEM_DELETE, 0, R.string.menu_deleteContact);
-    }
-
-    @Override
-    public boolean onContextItemSelected(MenuItem item) {
-        AdapterView.AdapterContextMenuInfo info;
-        try {
-             info = (AdapterView.AdapterContextMenuInfo) item.getMenuInfo();
-        } catch (ClassCastException e) {
-            Log.wtf(TAG, "Bad menuInfo", e);
-            return false;
-        }
-
-        ContactListAdapter adapter = mContactListFragment.getAdapter();
-        int headerViewsCount = mContactListFragment.getListView().getHeaderViewsCount();
-        int position = info.position - headerViewsCount;
-
-        final Uri contactUri = adapter.getContactUri(position);
-        switch (item.getItemId()) {
-            case MENU_ITEM_VIEW_CONTACT: {
-                mContactListFragment.viewContact(contactUri);
-                return true;
-            }
-
-            case MENU_ITEM_TOGGLE_STAR: {
-                if (adapter.isContactStarred(position)) {
-                    mContactListFragment.removeFromFavorites(contactUri);
-                } else {
-                    mContactListFragment.addToFavorites(contactUri);
-                }
-                return true;
-            }
-
-            case MENU_ITEM_CALL: {
-                mContactListFragment.callContact(contactUri);
-                return true;
-            }
-
-            case MENU_ITEM_SEND_SMS: {
-                mContactListFragment.smsContact(contactUri);
-                return true;
-            }
-
-            case MENU_ITEM_EDIT: {
-                mContactListFragment.editContact(contactUri);
-                return true;
-            }
-
-            case MENU_ITEM_DELETE: {
-                mContactListFragment.deleteContact(contactUri);
-                return true;
-            }
-        }
-
-        return false;
-    }
-}
diff --git a/src/com/android/contacts/list/ContactListAdapter.java b/src/com/android/contacts/list/ContactListAdapter.java
index 6eb9423..bc988e4 100644
--- a/src/com/android/contacts/list/ContactListAdapter.java
+++ b/src/com/android/contacts/list/ContactListAdapter.java
@@ -42,64 +42,48 @@
         Contacts._ID,                           // 0
         Contacts.DISPLAY_NAME_PRIMARY,          // 1
         Contacts.DISPLAY_NAME_ALTERNATIVE,      // 2
-        Contacts.SORT_KEY_PRIMARY,              // 3
-        Contacts.STARRED,                       // 4
-        Contacts.CONTACT_PRESENCE,              // 5
-        Contacts.CONTACT_STATUS,                // 6
-        Contacts.PHOTO_ID,                      // 7
-        Contacts.PHOTO_THUMBNAIL_URI,           // 8
-        Contacts.LOOKUP_KEY,                    // 9
-        Contacts.PHONETIC_NAME,                 // 10
-        Contacts.HAS_PHONE_NUMBER,              // 11
-        Contacts.IS_USER_PROFILE,               // 12
+        Contacts.CONTACT_PRESENCE,              // 3
+        Contacts.CONTACT_STATUS,                // 4
+        Contacts.PHOTO_ID,                      // 5
+        Contacts.PHOTO_THUMBNAIL_URI,           // 6
+        Contacts.LOOKUP_KEY,                    // 7
+        Contacts.IS_USER_PROFILE,               // 8
     };
 
     protected static final String[] PROJECTION_DATA = new String[] {
         Data.CONTACT_ID,                        // 0
         Data.DISPLAY_NAME_PRIMARY,              // 1
         Data.DISPLAY_NAME_ALTERNATIVE,          // 2
-        Data.SORT_KEY_PRIMARY,                  // 3
-        Data.STARRED,                           // 4
-        Data.CONTACT_PRESENCE,                  // 5
-        Data.CONTACT_STATUS,                    // 6
-        Data.PHOTO_ID,                          // 7
-        Data.PHOTO_THUMBNAIL_URI,               // 8
-        Data.LOOKUP_KEY,                        // 9
-        Data.PHONETIC_NAME,                     // 10
-        Data.HAS_PHONE_NUMBER,                  // 11
+        Data.CONTACT_PRESENCE,                  // 3
+        Data.CONTACT_STATUS,                    // 4
+        Data.PHOTO_ID,                          // 5
+        Data.PHOTO_THUMBNAIL_URI,               // 6
+        Data.LOOKUP_KEY,                        // 7
     };
 
     protected static final String[] FILTER_PROJECTION = new String[] {
         Contacts._ID,                           // 0
         Contacts.DISPLAY_NAME_PRIMARY,          // 1
         Contacts.DISPLAY_NAME_ALTERNATIVE,      // 2
-        Contacts.SORT_KEY_PRIMARY,              // 3
-        Contacts.STARRED,                       // 4
-        Contacts.CONTACT_PRESENCE,              // 5
-        Contacts.CONTACT_STATUS,                // 6
-        Contacts.PHOTO_ID,                      // 7
-        Contacts.PHOTO_THUMBNAIL_URI,           // 8
-        Contacts.LOOKUP_KEY,                    // 9
-        Contacts.PHONETIC_NAME,                 // 10
-        Contacts.HAS_PHONE_NUMBER,              // 11
-        Contacts.IS_USER_PROFILE,               // 12
-        SearchSnippetColumns.SNIPPET,           // 13
+        Contacts.CONTACT_PRESENCE,              // 3
+        Contacts.CONTACT_STATUS,                // 4
+        Contacts.PHOTO_ID,                      // 5
+        Contacts.PHOTO_THUMBNAIL_URI,           // 6
+        Contacts.LOOKUP_KEY,                    // 7
+        Contacts.IS_USER_PROFILE,               // 8
+        SearchSnippetColumns.SNIPPET,           // 9
     };
 
     protected static final int CONTACT_ID_COLUMN_INDEX = 0;
     protected static final int CONTACT_DISPLAY_NAME_PRIMARY_COLUMN_INDEX = 1;
     protected static final int CONTACT_DISPLAY_NAME_ALTERNATIVE_COLUMN_INDEX = 2;
-    protected static final int CONTACT_SORT_KEY_PRIMARY_COLUMN_INDEX = 3;
-    protected static final int CONTACT_STARRED_COLUMN_INDEX = 4;
-    protected static final int CONTACT_PRESENCE_STATUS_COLUMN_INDEX = 5;
-    protected static final int CONTACT_CONTACT_STATUS_COLUMN_INDEX = 6;
-    protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 7;
-    protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 8;
-    protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 9;
-    protected static final int CONTACT_PHONETIC_NAME_COLUMN_INDEX = 10;
-    protected static final int CONTACT_HAS_PHONE_COLUMN_INDEX = 11;
-    protected static final int CONTACT_IS_USER_PROFILE = 12;
-    protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 13;
+    protected static final int CONTACT_PRESENCE_STATUS_COLUMN_INDEX = 3;
+    protected static final int CONTACT_CONTACT_STATUS_COLUMN_INDEX = 4;
+    protected static final int CONTACT_PHOTO_ID_COLUMN_INDEX = 5;
+    protected static final int CONTACT_PHOTO_URI_COLUMN_INDEX = 6;
+    protected static final int CONTACT_LOOKUP_KEY_COLUMN_INDEX = 7;
+    protected static final int CONTACT_IS_USER_PROFILE = 8;
+    protected static final int CONTACT_SNIPPET_COLUMN_INDEX = 9;
 
     private CharSequence mUnknownNameText;
     private int mDisplayNameColumnIndex;
@@ -144,14 +128,6 @@
                 .appendQueryParameter(ContactCounts.ADDRESS_BOOK_INDEX_EXTRAS, "true").build();
     }
 
-    public boolean getHasPhoneNumber(int position) {
-        return ((Cursor)getItem(position)).getInt(CONTACT_HAS_PHONE_COLUMN_INDEX) != 0;
-    }
-
-    public boolean isContactStarred(int position) {
-        return ((Cursor)getItem(position)).getInt(CONTACT_STARRED_COLUMN_INDEX) != 0;
-    }
-
     @Override
     public String getContactDisplayName(int position) {
         return ((Cursor)getItem(position)).getString(mDisplayNameColumnIndex);
@@ -266,7 +242,7 @@
     protected void bindName(final ContactListItemView view, Cursor cursor) {
         view.showDisplayName(cursor, mDisplayNameColumnIndex, mAlternativeDisplayNameColumnIndex,
                 false, getContactNameDisplayOrder());
-        view.showPhoneticName(cursor, CONTACT_PHONETIC_NAME_COLUMN_INDEX);
+        // Note: we don't show phonetic any more (See issue 5265330)
     }
 
     protected void bindPresenceAndStatusMessage(final ContactListItemView view, Cursor cursor) {
diff --git a/src/com/android/contacts/list/ContactTileAdapter.java b/src/com/android/contacts/list/ContactTileAdapter.java
index 48bc5c3..3eb7232 100644
--- a/src/com/android/contacts/list/ContactTileAdapter.java
+++ b/src/com/android/contacts/list/ContactTileAdapter.java
@@ -27,6 +27,7 @@
 import android.content.Context;
 import android.content.res.Resources;
 import android.database.Cursor;
+import android.graphics.Rect;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.provider.ContactsContract.CommonDataKinds.Phone;
@@ -477,7 +478,8 @@
         @Override
         public void onClick(ContactTileView contactTileView) {
             if (mListener != null) {
-                mListener.onContactSelected(contactTileView.getLookupUri());
+                mListener.onContactSelected(contactTileView.getLookupUri(),
+                        ContactsUtils.getTargetRectFromView(mContext, contactTileView));
             }
         }
     };
@@ -659,6 +661,6 @@
     }
 
     public interface Listener {
-        public void onContactSelected(Uri contactUri);
+        public void onContactSelected(Uri contactUri, Rect targetRect);
     }
 }
diff --git a/src/com/android/contacts/list/ContactTileListFragment.java b/src/com/android/contacts/list/ContactTileListFragment.java
index f28c2b5..d4d961b 100644
--- a/src/com/android/contacts/list/ContactTileListFragment.java
+++ b/src/com/android/contacts/list/ContactTileListFragment.java
@@ -28,6 +28,7 @@
 import android.content.Loader;
 import android.content.res.Resources;
 import android.database.Cursor;
+import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Bundle;
 import android.view.LayoutInflater;
@@ -48,7 +49,7 @@
     private static final String TAG = ContactTileListFragment.class.getSimpleName();
 
     public interface Listener {
-        public void onContactSelected(Uri contactUri);
+        public void onContactSelected(Uri contactUri, Rect targetRect);
     }
 
     private static int LOADER_CONTACTS = 1;
@@ -166,9 +167,9 @@
     private ContactTileAdapter.Listener mAdapterListener =
             new ContactTileAdapter.Listener() {
         @Override
-        public void onContactSelected(Uri contactUri) {
+        public void onContactSelected(Uri contactUri, Rect targetRect) {
             if (mListener != null) {
-                mListener.onContactSelected(contactUri);
+                mListener.onContactSelected(contactUri, targetRect);
             }
         }
     };
diff --git a/src/com/android/contacts/list/PhoneFavoriteFragment.java b/src/com/android/contacts/list/PhoneFavoriteFragment.java
index 6876789..b6e8dd6 100644
--- a/src/com/android/contacts/list/PhoneFavoriteFragment.java
+++ b/src/com/android/contacts/list/PhoneFavoriteFragment.java
@@ -29,6 +29,7 @@
 import android.content.Intent;
 import android.content.Loader;
 import android.database.Cursor;
+import android.graphics.Rect;
 import android.net.Uri;
 import android.os.Bundle;
 import android.provider.ContactsContract.Directory;
@@ -131,7 +132,7 @@
 
     private class ContactTileAdapterListener implements ContactTileAdapter.Listener {
         @Override
-        public void onContactSelected(Uri contactUri) {
+        public void onContactSelected(Uri contactUri, Rect targetRect) {
             if (mListener != null) {
                 mListener.onContactSelected(contactUri);
             }
diff --git a/src/com/android/contacts/list/PhoneNumberListAdapter.java b/src/com/android/contacts/list/PhoneNumberListAdapter.java
index b16b10c..459d232 100644
--- a/src/com/android/contacts/list/PhoneNumberListAdapter.java
+++ b/src/com/android/contacts/list/PhoneNumberListAdapter.java
@@ -53,7 +53,6 @@
         Phone.CONTACT_ID,                   // 6
         Phone.LOOKUP_KEY,                   // 7
         Phone.PHOTO_ID,                     // 8
-        Phone.PHONETIC_NAME,                // 9
     };
 
     protected static final int PHONE_ID_COLUMN_INDEX = 0;
@@ -65,7 +64,6 @@
     protected static final int PHONE_CONTACT_ID_COLUMN_INDEX = 6;
     protected static final int PHONE_LOOKUP_KEY_COLUMN_INDEX = 7;
     protected static final int PHONE_PHOTO_ID_COLUMN_INDEX = 8;
-    protected static final int PHONE_PHONETIC_NAME_COLUMN_INDEX = 9;
 
     private CharSequence mUnknownNameText;
     private int mDisplayNameColumnIndex;
@@ -230,9 +228,8 @@
         // Look at elements before and after this position, checking if contact IDs are same.
         // If they have one same contact ID, it means they can be grouped.
         //
-        // In one group, only the first entry will show its photo and names (display name and
-        // phonetic name), and the other entries in the group show just their data (e.g. phone
-        // number, email address).
+        // In one group, only the first entry will show its photo and its name, and the other
+        // entries in the group show just their data (e.g. phone number, email address).
         cursor.moveToPosition(position);
         boolean isFirstEntry = true;
         boolean showBottomDivider = true;
@@ -302,12 +299,11 @@
     protected void bindName(final ContactListItemView view, Cursor cursor) {
         view.showDisplayName(cursor, mDisplayNameColumnIndex, mAlternativeDisplayNameColumnIndex,
                 false, getContactNameDisplayOrder());
-        view.showPhoneticName(cursor, PHONE_PHONETIC_NAME_COLUMN_INDEX);
+        // Note: we don't show phonetic names any more (see issue 5265330)
     }
 
     protected void unbindName(final ContactListItemView view) {
         view.hideDisplayName();
-        view.hidePhoneticName();
     }
 
     protected void bindPhoto(final ContactListItemView view, Cursor cursor) {