Add ExpandingEntryCardView to QuickContact

The communication card is slightly implemented to make sure ExpandingEntryCardView
works as intended. There is more work to do in a different CL to finish this.

Also delete a bunch of QC code.

Change-Id: If7d8373866560c635851fe0e09ffad9cc0054f4f
diff --git a/res/layout/expanding_entry_card_item.xml b/res/layout/expanding_entry_card_item.xml
new file mode 100644
index 0000000..5f2deeb
--- /dev/null
+++ b/res/layout/expanding_entry_card_item.xml
@@ -0,0 +1,87 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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:orientation="horizontal">
+
+    <RelativeLayout
+        style="@style/SelectableItem"
+        android:id="@+id/entry_layout"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:paddingLeft="@dimen/expanding_entry_card_item_padding_with_image_start"
+        android:paddingRight="@dimen/expanding_entry_card_item_padding_end"
+        android:paddingTop="@dimen/expanding_entry_card_item_padding_top"
+        android:paddingBottom="@dimen/expanding_entry_card_item_padding_bottom">
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/icon"
+            android:layout_alignParentLeft="true"
+            android:layout_alignParentTop="true"
+            android:layout_marginRight="@dimen/expanding_entry_card_item_image_spacing"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/header"
+            android:layout_alignParentTop="true"
+            android:layout_toRightOf="@+id/icon"
+            android:textStyle="bold"
+            android:textColor="@android:color/black"
+            android:singleLine="true"/>
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/sub_header"
+            android:layout_below="@+id/header"
+            android:layout_toRightOf="@+id/icon_sub_header"
+            android:textColor="@android:color/black"/>
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/icon_sub_header"
+            android:layout_below="@+id/header"
+            android:layout_toRightOf="@+id/icon"
+            android:layout_marginRight="@dimen/expanding_entry_card_item_sub_header_icon_margin_right"
+            android:layout_marginBottom="@dimen/expanding_entry_card_item_sub_header_icon_margin_bottom" />
+
+        <TextView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/text"
+            android:layout_below="@+id/sub_header"
+            android:layout_toRightOf="@+id/icon_text"
+            android:textColor="@android:color/darker_gray"/>
+
+        <ImageView
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:id="@+id/icon_text"
+            android:layout_toRightOf="@+id/icon"
+            android:layout_below="@+id/sub_header"
+            android:layout_marginTop="@dimen/expanding_entry_card_item_text_icon_margin_top"
+            android:layout_marginRight="@dimen/expanding_entry_card_item_text_icon_margin_right" />
+    </RelativeLayout>
+
+</LinearLayout>
diff --git a/res/layout/expanding_entry_card_view.xml b/res/layout/expanding_entry_card_view.xml
new file mode 100644
index 0000000..12f96e6
--- /dev/null
+++ b/res/layout/expanding_entry_card_view.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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.
+-->
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
+
+    <TextView
+        android:id="@+id/title"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:ellipsize="end"
+        android:lines="1"
+        android:padding="@dimen/expanding_entry_card_title_padding"
+        android:singleLine="true"
+        android:textSize="@dimen/expanding_entry_card_title_text_size" />
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/expanding_entry_card_item_separator_height"
+        android:background="@color/expanding_entry_card_item_separator_color" />
+
+    <LinearLayout
+        android:id="@+id/content_area_linear_layout"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:orientation="vertical" />
+
+</merge>
\ No newline at end of file
diff --git a/res/layout/quickcontact_activity.xml b/res/layout/quickcontact_activity.xml
index 36bdd50..3aa0a14 100644
--- a/res/layout/quickcontact_activity.xml
+++ b/res/layout/quickcontact_activity.xml
@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2011 The Android Open Source Project
+<!--
+     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.
@@ -13,44 +14,37 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<view
-    xmlns:android="http://schemas.android.com/apk/res/android"
+<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
     xmlns:ex="http://schemas.android.com/apk/res-auto"
-    class="com.android.contacts.quickcontact.FloatingChildLayout"
-    android:id="@+id/floating_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
+    android:orientation="vertical"
     android:focusable="true"
     android:focusableInTouchMode="true"
-    android:descendantFocusability="afterDescendants">
+    android:descendantFocusability="afterDescendants" >
+
     <LinearLayout
         android:id="@android:id/content"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:paddingLeft="15dip"
-        android:paddingRight="15dip"
-        android:paddingStart="15dip"
-        android:paddingEnd="15dip"
-        android:paddingTop="8dip"
-        android:orientation="vertical">
+        android:orientation="vertical" >
+
         <view
-            class="com.android.contacts.common.widget.ProportionalLayout"
             android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            ex:ratio="0.5"
-            ex:direction="widthToHeight">
+            class="com.android.contacts.common.widget.ProportionalLayout"
+            ex:direction="widthToHeight"
+            ex:ratio="0.5" >
+
             <include layout="@layout/quickcontact_photo_container" />
         </view>
-        <include layout="@layout/quickcontact_track" />
-        <View
-            android:id="@+id/line_after_track"
+
+        <com.android.contacts.quickcontact.ExpandingEntryCardView
+            android:id="@+id/communication_card"
             android:layout_width="match_parent"
-            android:layout_height="2dip"
-            android:background="@color/quickcontact_tab_indicator" />
-        <android.support.v4.view.ViewPager
-            android:id="@+id/item_list_pager"
-            android:layout_width="match_parent"
-            android:layout_height="156dip"
-            android:background="@color/quickcontact_activity_background"/>
+            android:layout_height="wrap_content"
+            android:background="@color/quickcontact_activity_background"
+            android:orientation="vertical" />
     </LinearLayout>
-</view>
+
+</ScrollView>
\ No newline at end of file
diff --git a/res/layout/quickcontact_expanding_entry_card_button.xml b/res/layout/quickcontact_expanding_entry_card_button.xml
new file mode 100644
index 0000000..9cd34d7
--- /dev/null
+++ b/res/layout/quickcontact_expanding_entry_card_button.xml
@@ -0,0 +1,39 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2014 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:orientation="vertical"
+    style="@style/SelectableItem" >
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/expanding_entry_card_item_separator_height"
+        android:background="@color/expanding_entry_card_item_separator_color" />
+
+    <TextView
+        android:id="@+id/text"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:drawablePadding="@dimen/expanding_entry_card_button_drawable_padding"
+        android:gravity="center_vertical"
+        android:paddingBottom="@dimen/expanding_entry_card_button_padding_vertical"
+        android:paddingLeft="@dimen/expanding_entry_card_button_padding_start"
+        android:paddingTop="@dimen/expanding_entry_card_button_padding_vertical"
+        android:textColor="@color/expanding_entry_card_button_text_color" />
+
+</LinearLayout>
\ No newline at end of file
diff --git a/res/layout/quickcontact_list_fragment.xml b/res/layout/quickcontact_list_fragment.xml
deleted file mode 100755
index 712f116..0000000
--- a/res/layout/quickcontact_list_fragment.xml
+++ /dev/null
@@ -1,34 +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.
--->
-
-<RelativeLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content">
-    <ListView
-        android:id="@+id/list"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:divider="@drawable/quickcontact_list_item_divider"
-        android:dividerHeight="1dip"
-        android:background="@color/quickcontact_list_background"
-        android:cacheColorHint="@null"
-        android:layout_alignParentTop="true"
-    />
-    <View
-        android:layout_alignBottom="@+id/list"
-        style="@style/QuickContactListBottomStyle"/>
-</RelativeLayout>
diff --git a/res/layout/quickcontact_list_item.xml b/res/layout/quickcontact_list_item.xml
deleted file mode 100755
index 615895f..0000000
--- a/res/layout/quickcontact_list_item.xml
+++ /dev/null
@@ -1,54 +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.
--->
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/actions_view_container"
-    android:nextFocusRight="@+id/secondary_action_button"
-    style="@style/QuickContactListItemStyle">
-    <LinearLayout style="@style/QuickContactListItemTextWrapperStyle">
-        <TextView
-            android:id="@android:id/text1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/primary_text_color"
-            android:textAppearance="?android:attr/textAppearanceMedium"
-            android:singleLine="true"
-            android:ellipsize="end" />
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-            <ImageView
-                android:id="@+id/presence_icon"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="1dip"
-                android:layout_marginRight="4dip"
-                android:layout_marginEnd="4dip"
-                android:layout_gravity="center_vertical"
-                android:gravity="center"
-                android:scaleType="centerInside" />
-            <TextView
-                android:id="@android:id/text2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="@color/secondary_text_color"
-                android:textAllCaps="true"
-                android:textAppearance="?android:attr/textAppearanceSmall" />
-        </LinearLayout>
-    </LinearLayout>
-    <include layout="@layout/quickcontact_list_item_base"/>
-</LinearLayout>
diff --git a/res/layout/quickcontact_list_item_address.xml b/res/layout/quickcontact_list_item_address.xml
deleted file mode 100755
index c55c339..0000000
--- a/res/layout/quickcontact_list_item_address.xml
+++ /dev/null
@@ -1,55 +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.
--->
-
-<LinearLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:id="@+id/actions_view_container"
-    android:nextFocusRight="@+id/secondary_action_button"
-    style="@style/QuickContactListItemStyle">
-    <LinearLayout style="@style/QuickContactListItemTextWrapperStyle"
-        android:layout_marginTop="12dip"
-        android:layout_marginBottom="12dip">
-        <TextView
-            android:id="@android:id/text1"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:textColor="@color/primary_text_color"
-            android:textAppearance="?android:attr/textAppearanceMedium" />
-        <LinearLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:orientation="horizontal">
-            <ImageView
-                android:id="@+id/presence_icon"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_marginTop="1dip"
-                android:layout_marginRight="4dip"
-                android:layout_marginEnd="4dip"
-                android:layout_gravity="center_vertical"
-                android:gravity="center"
-                android:scaleType="centerInside" />
-            <TextView
-                android:id="@android:id/text2"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="@color/secondary_text_color"
-                android:textAllCaps="true"
-                android:textAppearance="?android:attr/textAppearanceSmall" />
-        </LinearLayout>
-    </LinearLayout>
-    <include layout="@layout/quickcontact_list_item_base"/>
-</LinearLayout>
diff --git a/res/layout/quickcontact_list_item_base.xml b/res/layout/quickcontact_list_item_base.xml
deleted file mode 100644
index 80a3422..0000000
--- a/res/layout/quickcontact_list_item_base.xml
+++ /dev/null
@@ -1,42 +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.
--->
-
-<merge xmlns:android="http://schemas.android.com/apk/res/android">
-    <View
-        android:id="@+id/vertical_divider"
-        android:layout_width="1dip"
-        android:layout_height="match_parent"
-        android:layout_gravity="center_vertical"
-        android:layout_marginTop="@dimen/detail_vertical_divider_vertical_margin"
-        android:layout_marginBottom="@dimen/detail_vertical_divider_vertical_margin"
-        android:background="?android:attr/dividerVertical" />
-    <ImageView
-        android:id="@+id/secondary_action_button"
-        android:layout_width="wrap_content"
-        android:layout_height="match_parent"
-        android:paddingLeft="8dip"
-        android:paddingRight="14dip"
-        android:paddingStart="8dip"
-        android:paddingEnd="14dip"
-        android:background="?android:attr/selectableItemBackground"
-        android:duplicateParentState="false"
-        android:nextFocusLeft="@id/actions_view_container"/>
-    <View
-        android:layout_width="1dip"
-        android:layout_height="match_parent"
-        android:layout_gravity="center_vertical"
-        android:background="?android:attr/dividerVertical" />
-</merge>
diff --git a/res/layout/quickcontact_track.xml b/res/layout/quickcontact_track.xml
deleted file mode 100644
index 83a771c..0000000
--- a/res/layout/quickcontact_track.xml
+++ /dev/null
@@ -1,43 +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.
--->
-<merge
-    xmlns:android="http://schemas.android.com/apk/res/android">
-    <HorizontalScrollView
-        android:id="@+id/track_scroller"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:fadingEdgeLength="0dip"
-        android:background="@color/quickcontact_track_background"
-        android:scrollbars="none">
-        <RelativeLayout
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content">
-            <LinearLayout
-                android:id="@+id/track"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:orientation="horizontal" />
-            <View
-                android:id="@+id/selected_tab_rectangle"
-                android:layout_width="60dip"
-                android:layout_height="6dip"
-                android:layout_alignBottom="@id/track"
-                android:layout_alignParentLeft="true"
-                android:layout_alignParentStart="true"
-                android:background="@color/quickcontact_tab_indicator" />
-        </RelativeLayout>
-    </HorizontalScrollView>
-</merge>
diff --git a/res/layout/quickcontact_track_button.xml b/res/layout/quickcontact_track_button.xml
deleted file mode 100644
index f9dcd1d..0000000
--- a/res/layout/quickcontact_track_button.xml
+++ /dev/null
@@ -1,30 +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.
--->
-
-<com.android.contacts.quickcontact.CheckableImageView
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="60dip"
-    android:layout_height="60dip"
-    android:paddingLeft="12dip"
-    android:paddingRight="12dip"
-    android:paddingStart="12dip"
-    android:paddingEnd="12dip"
-    android:paddingTop="8dip"
-    android:paddingBottom="8dip"
-    android:scaleType="centerInside"
-    android:focusable="true"
-    android:clickable="true"
-    android:background="?android:attr/selectableItemBackground" />