Contact card with and without social updates

- This is for the phone (landscape and portrait)
- Some tweaks were done to the tablet to prevent regression
but it's not quite ready yet
- No social updates means a single scrolling list of details
- Having social updates means a tab carousel and ViewPager
- Add invisible contact loader fragment
- Now the loader fragment loads the contact --> passes to
ContactDetailActivity --> passes to all necessary fragments /
carousels (no matter the configuration)
- Get rid of ContactDetailAboutFragment and move those changes
into the ContactDetailFragment

Change-Id: I7be55ae7205bbcb8106bf2f2e4ae8dd6ce2c6a78
diff --git a/res/layout-sw580dp/simple_contact_detail_header_view_list_item.xml b/res/layout-sw580dp/simple_contact_detail_header_view_list_item.xml
new file mode 100644
index 0000000..b14d563
--- /dev/null
+++ b/res/layout-sw580dp/simple_contact_detail_header_view_list_item.xml
@@ -0,0 +1,69 @@
+<?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.
+-->
+
+<!--
+  This view temporarily holds the extra information that used to be in the
+  original contact detail header view, but now must move into the list because
+  of the new tab carousel. TODO: Integrate this better into the list as provided
+  by the mocks.
+-->
+<LinearLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:orientation="vertical"
+    android:paddingTop="20dip">
+
+    <ImageView
+        android:id="@+id/photo"
+        android:scaleType="centerCrop"
+        android:layout_width="@dimen/detail_contact_photo_size"
+        android:layout_height="@dimen/detail_contact_photo_size" />
+
+    <TextView
+        android:id="@+id/name"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceLarge"
+        android:textSize="36sp" />
+
+    <TextView
+        android:id="@+id/company"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceMedium" />
+
+    <TextView
+        android:id="@+id/phonetic_name"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
+
+    <TextView
+        android:id="@+id/attribution"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:textAppearance="?android:attr/textAppearanceSmall" />
+
+    <CheckBox
+        android:id="@+id/star"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_gravity="top"
+        android:contentDescription="@string/description_star"
+        style="?android:attr/starStyle" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout-w470dp/contact_detail_activity.xml b/res/layout-w470dp/contact_detail_container_with_updates.xml
similarity index 84%
rename from res/layout-w470dp/contact_detail_activity.xml
rename to res/layout-w470dp/contact_detail_container_with_updates.xml
index bf649a2..a8ee0a5 100644
--- a/res/layout-w470dp/contact_detail_activity.xml
+++ b/res/layout-w470dp/contact_detail_container_with_updates.xml
@@ -15,15 +15,13 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/contact_detail_view"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:orientation="vertical">
 
     <com.android.contacts.detail.ContactDetailFragmentCarousel
         android:id="@+id/fragment_carousel"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentLeft="true"
         android:layout_width="match_parent"
         android:layout_height="match_parent"/>
 
-</FrameLayout>
+</FrameLayout>
\ No newline at end of file
diff --git a/res/layout/contact_detail_activity.xml b/res/layout/contact_detail_activity.xml
index d840d6f..3ab40c3 100644
--- a/res/layout/contact_detail_activity.xml
+++ b/res/layout/contact_detail_activity.xml
@@ -14,24 +14,17 @@
      limitations under the License.
 -->
 
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/contact_detail_view"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:orientation="vertical">
+    android:layout_height="match_parent">
 
-    <android.support.v4.view.ViewPager
-        android:id="@+id/pager"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentLeft="true"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent" />
+    <!-- This fragment is an invisible worker fragment that loads the contact details. -->
+    <fragment
+        android:id="@+id/loader_fragment"
+        class="com.android.contacts.detail.ContactLoaderFragment"
+        android:layout_height="0dip"
+        android:layout_width="0dip"
+        android:visibility="gone"/>
 
-    <com.android.contacts.detail.ContactDetailTabCarousel
-        android:id="@+id/tab_carousel"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentLeft="true"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"/>
-
-</RelativeLayout>
+</FrameLayout>
diff --git a/res/layout/contact_detail_container_with_updates.xml b/res/layout/contact_detail_container_with_updates.xml
new file mode 100644
index 0000000..de7d145
--- /dev/null
+++ b/res/layout/contact_detail_container_with_updates.xml
@@ -0,0 +1,36 @@
+<?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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:orientation="vertical">
+
+    <android.support.v4.view.ViewPager
+        android:id="@+id/pager"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentLeft="true"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent" />
+
+    <com.android.contacts.detail.ContactDetailTabCarousel
+        android:id="@+id/tab_carousel"
+        android:layout_alignParentTop="true"
+        android:layout_alignParentLeft="true"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"/>
+
+</RelativeLayout>
diff --git a/res/layout-w470dp/contact_detail_activity.xml b/res/layout/contact_detail_container_without_updates.xml
similarity index 72%
copy from res/layout-w470dp/contact_detail_activity.xml
copy to res/layout/contact_detail_container_without_updates.xml
index bf649a2..884f280 100644
--- a/res/layout-w470dp/contact_detail_activity.xml
+++ b/res/layout/contact_detail_container_without_updates.xml
@@ -14,15 +14,14 @@
      limitations under the License.
 -->
 
-<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/contact_detail_view"
+<FrameLayout
+    xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 
-    <com.android.contacts.detail.ContactDetailFragmentCarousel
-        android:id="@+id/fragment_carousel"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentLeft="true"
+    <fragment
+        android:id="@+id/contact_detail_fragment"
+        class="com.android.contacts.detail.ContactDetailFragment"
         android:layout_width="match_parent"
         android:layout_height="match_parent"/>
 
diff --git a/res/layout/contact_detail_fragment.xml b/res/layout/contact_detail_fragment.xml
index 70a9a28..d16771c 100644
--- a/res/layout/contact_detail_fragment.xml
+++ b/res/layout/contact_detail_fragment.xml
@@ -15,7 +15,7 @@
 -->
 
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/contact_detail"
+    android:id="@+id/contact_detail_about_fragment"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
@@ -25,15 +25,14 @@
         android:layout_height="0px"
         android:layout_weight="1"
         android:background="@color/background_primary"
-        android:divider="@null"
-    />
+        android:divider="@null"/>
 
     <ScrollView android:id="@android:id/empty"
         android:layout_width="match_parent"
         android:layout_height="0px"
         android:layout_weight="1"
-        android:visibility="gone"
-    >
+        android:visibility="gone">
+
         <TextView android:id="@+id/emptyText"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
@@ -43,8 +42,8 @@
             android:paddingLeft="10dip"
             android:paddingRight="10dip"
             android:paddingTop="10dip"
-            android:lineSpacingMultiplier="0.92"
-        />
+            android:lineSpacingMultiplier="0.92"/>
+
     </ScrollView>
 
     <!-- "Copy to my contacts"- button -->
diff --git a/res/layout/contact_detail_fragment_carousel.xml b/res/layout/contact_detail_fragment_carousel.xml
index 165b6a1..312fdf2 100644
--- a/res/layout/contact_detail_fragment_carousel.xml
+++ b/res/layout/contact_detail_fragment_carousel.xml
@@ -21,7 +21,7 @@
     android:scrollbars="none"
     android:orientation="horizontal">
 
-    <fragment class="com.android.contacts.detail.ContactDetailAboutFragment"
+    <fragment class="com.android.contacts.detail.ContactDetailFragment"
         android:id="@+id/about_fragment"
         android:layout_width="@dimen/detail_fragment_carousel_fragment_width"
         android:layout_height="match_parent" />
diff --git a/res/layout-w470dp/contact_detail_activity.xml b/res/layout/contact_detail_loader_fragment.xml
similarity index 62%
copy from res/layout-w470dp/contact_detail_activity.xml
copy to res/layout/contact_detail_loader_fragment.xml
index bf649a2..3c4bbef 100644
--- a/res/layout-w470dp/contact_detail_activity.xml
+++ b/res/layout/contact_detail_loader_fragment.xml
@@ -15,15 +15,6 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/contact_detail_view"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent">
-
-    <com.android.contacts.detail.ContactDetailFragmentCarousel
-        android:id="@+id/fragment_carousel"
-        android:layout_alignParentTop="true"
-        android:layout_alignParentLeft="true"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"/>
-
-</FrameLayout>
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:visibility="gone"/>
\ No newline at end of file
diff --git a/res/layout/contact_detail_updates_fragment.xml b/res/layout/contact_detail_updates_fragment.xml
index daa5608..e9c36f3 100644
--- a/res/layout/contact_detail_updates_fragment.xml
+++ b/res/layout/contact_detail_updates_fragment.xml
@@ -15,7 +15,7 @@
 -->
 
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/contact_detail"
+    android:id="@+id/contact_detail_updates_fragment"
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
diff --git a/res/layout/favorites_star.xml b/res/layout/favorites_star.xml
index f2afa31..4b859b4 100644
--- a/res/layout/favorites_star.xml
+++ b/res/layout/favorites_star.xml
@@ -20,12 +20,15 @@
     android:layout_height="wrap_content"
     android:paddingLeft="10dip"
     android:paddingRight="10dip">
+
     <CheckBox
         android:id="@+id/star"
+        android:duplicateParentState="true"
         android:layout_width="wrap_content"
         android:layout_height="wrap_content"
         android:layout_gravity="center_vertical"
         android:contentDescription="@string/description_star"
         android:visibility="invisible"
         style="?android:attr/starStyle"/>
+
 </FrameLayout>
\ No newline at end of file
diff --git a/res/layout/simple_contact_detail_header_view_list_item.xml b/res/layout/simple_contact_detail_header_view_list_item.xml
index 1fd9ec5..0c0867f 100644
--- a/res/layout/simple_contact_detail_header_view_list_item.xml
+++ b/res/layout/simple_contact_detail_header_view_list_item.xml
@@ -22,10 +22,15 @@
 -->
 <LinearLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="wrap_content"
+    android:layout_width="match_parent"
     android:layout_height="wrap_content"
-    android:orientation="vertical"
-    android:paddingTop="@dimen/detail_tab_carousel_height">
+    android:orientation="vertical">
+
+    <ImageView
+        android:id="@+id/photo"
+        android:scaleType="centerCrop"
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/detail_tab_carousel_height" />
 
     <TextView
         android:id="@+id/phonetic_name"
diff --git a/res/values-sw580dp/dimens.xml b/res/values-sw580dp/dimens.xml
index b2f2af1..f1e5736 100644
--- a/res/values-sw580dp/dimens.xml
+++ b/res/values-sw580dp/dimens.xml
@@ -32,4 +32,5 @@
     <dimen name="shortcut_icon_size">64dip</dimen>
     <dimen name="list_section_height">37dip</dimen>
     <dimen name="directory_header_height">56dip</dimen>
+    <dimen name="detail_tab_carousel_height">150dip</dimen>
 </resources>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 95bbb63..d248f5b 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -109,6 +109,9 @@
     <!-- Margin around the contact's photo on the contact card -->
     <dimen name="detail_contact_photo_margin">15dip</dimen>
 
+    <!-- Width and height of the contact photo on the contact detail page -->
+    <dimen name="detail_contact_photo_size">256dip</dimen>
+
     <!-- Left and right padding for a contact detail item -->
     <dimen name="detail_item_icon_margin">10dip</dimen>