Convert caller information into list header.

this allows us to scroll the header with the rest of the screen,
instead of having it pinned to the top, as it is currently.

Bug: 24109819
Change-Id: Ic440bc18d31d196493a86130e06d954c453c9146
diff --git a/res/layout/call_detail.xml b/res/layout/call_detail.xml
index 591ba5c..7d91248 100644
--- a/res/layout/call_detail.xml
+++ b/res/layout/call_detail.xml
@@ -13,91 +13,12 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/call_detail"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:orientation="vertical"
-    android:layout_alignParentStart="true"
-    android:layout_alignParentTop="true"
     android:background="@color/background_dialer_call_log" >
 
-    <!-- Caller information "card" -->
-    <LinearLayout
-        android:id="@+id/caller_information"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:paddingStart="@dimen/call_detail_horizontal_margin"
-        android:paddingTop="@dimen/call_detail_top_margin"
-        android:paddingBottom="@dimen/call_detail_bottom_margin"
-        android:baselineAligned="false"
-        android:orientation="horizontal"
-        android:translationZ="@dimen/call_detail_translation_z"
-        android:focusable="true"
-        android:background="@color/background_dialer_white" >
-
-        <QuickContactBadge
-            android:id="@+id/quick_contact_photo"
-            android:layout_width="@dimen/contact_photo_size"
-            android:layout_height="@dimen/contact_photo_size"
-            android:layout_alignParentStart="true"
-            android:layout_gravity="top"
-            android:layout_marginTop="3dp"
-            android:focusable="true" />
-
-        <LinearLayout
-            android:layout_width="0dp"
-            android:layout_height="wrap_content"
-            android:layout_weight="1"
-            android:orientation="vertical"
-            android:gravity="center_vertical"
-            android:layout_marginStart="@dimen/call_detail_horizontal_margin">
-
-            <TextView
-                android:id="@+id/caller_name"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="?attr/call_log_primary_text_color"
-                android:textSize="@dimen/call_log_primary_text_size"
-                android:includeFontPadding="false"
-                android:layout_marginTop="2dp"
-                android:layout_marginBottom="3dp"
-                android:singleLine="true" />
-
-            <TextView
-                android:id="@+id/caller_number"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="?attr/call_log_secondary_text_color"
-                android:textSize="@dimen/call_log_secondary_text_size"
-                android:layout_marginBottom="1dp"
-                android:singleLine="true" />
-
-            <TextView
-                android:id="@+id/phone_account_label"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:textColor="?attr/call_log_secondary_text_color"
-                android:textSize="@dimen/call_log_secondary_text_size"
-                android:singleLine="true"
-                android:visibility="gone" />
-
-        </LinearLayout>
-
-        <ImageView
-            android:id="@+id/call_back_button"
-            android:layout_width="@dimen/call_log_list_item_primary_action_dimen"
-            android:layout_height="@dimen/call_log_list_item_primary_action_dimen"
-            android:layout_marginEnd="16dp"
-            android:background="?android:attr/selectableItemBackgroundBorderless"
-            android:src="@drawable/ic_call_24dp"
-            android:scaleType="center"
-            android:tint="@color/call_log_list_item_primary_action_icon_tint"
-            android:contentDescription="@string/description_call_log_call_action"
-            android:visibility="gone" />
-
-    </LinearLayout>
-
     <!--
       The list view is under everything.
       It contains a first header element which is hidden under the controls UI.
@@ -108,4 +29,4 @@
         android:layout_width="match_parent"
         android:layout_height="fill_parent" />
 
-</LinearLayout>
+</FrameLayout>
diff --git a/res/layout/call_detail_header.xml b/res/layout/call_detail_header.xml
new file mode 100644
index 0000000..5931445
--- /dev/null
+++ b/res/layout/call_detail_header.xml
@@ -0,0 +1,89 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2015 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/caller_information"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:paddingStart="@dimen/call_detail_horizontal_margin"
+    android:paddingTop="@dimen/call_detail_top_margin"
+    android:paddingBottom="@dimen/call_detail_bottom_margin"
+    android:baselineAligned="false"
+    android:orientation="horizontal"
+    android:elevation="@dimen/call_detail_elevation"
+    android:focusable="true"
+    android:background="@color/background_dialer_white" >
+
+    <QuickContactBadge
+        android:id="@+id/quick_contact_photo"
+        android:layout_width="@dimen/contact_photo_size"
+        android:layout_height="@dimen/contact_photo_size"
+        android:layout_alignParentStart="true"
+        android:layout_gravity="top"
+        android:layout_marginTop="3dp"
+        android:focusable="true" />
+
+    <LinearLayout
+        android:layout_width="0dp"
+        android:layout_height="wrap_content"
+        android:layout_weight="1"
+        android:orientation="vertical"
+        android:gravity="center_vertical"
+        android:layout_marginStart="@dimen/call_detail_horizontal_margin">
+
+        <TextView
+            android:id="@+id/caller_name"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="?attr/call_log_primary_text_color"
+            android:textSize="@dimen/call_log_primary_text_size"
+            android:includeFontPadding="false"
+            android:layout_marginTop="2dp"
+            android:layout_marginBottom="3dp"
+            android:singleLine="true" />
+
+        <TextView
+            android:id="@+id/caller_number"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="?attr/call_log_secondary_text_color"
+            android:textSize="@dimen/call_log_secondary_text_size"
+            android:layout_marginBottom="1dp"
+            android:singleLine="true" />
+
+        <TextView
+            android:id="@+id/phone_account_label"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:textColor="?attr/call_log_secondary_text_color"
+            android:textSize="@dimen/call_log_secondary_text_size"
+            android:singleLine="true"
+            android:visibility="gone" />
+
+    </LinearLayout>
+
+    <ImageView
+        android:id="@+id/call_back_button"
+        android:layout_width="@dimen/call_log_list_item_primary_action_dimen"
+        android:layout_height="@dimen/call_log_list_item_primary_action_dimen"
+        android:layout_marginEnd="16dp"
+        android:background="?android:attr/selectableItemBackgroundBorderless"
+        android:src="@drawable/ic_call_24dp"
+        android:scaleType="center"
+        android:tint="@color/call_log_list_item_primary_action_icon_tint"
+        android:contentDescription="@string/description_call_log_call_action"
+        android:visibility="gone" />
+
+</LinearLayout>
diff --git a/res/layout/call_details_voicemail_header.xml b/res/layout/call_details_voicemail_header.xml
deleted file mode 100644
index e3640fa..0000000
--- a/res/layout/call_details_voicemail_header.xml
+++ /dev/null
@@ -1,31 +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.
--->
-<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="wrap_content"
-    android:orientation="vertical" >
-
-        <LinearLayout
-            android:id="@+id/voicemail_container"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:orientation="vertical"
-            android:paddingBottom="@dimen/call_detail_button_spacing"
-            android:visibility="gone">
-            <!-- The voicemail fragment will be put here. -->
-        </LinearLayout>
-
-</LinearLayout>
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index d35a78d..1d57177 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -44,7 +44,7 @@
     <dimen name="call_detail_bottom_margin">16dp</dimen>
     <dimen name="call_detail_header_top_margin">20dp</dimen>
     <dimen name="call_detail_header_bottom_margin">9dp</dimen>
-    <dimen name="call_detail_translation_z">0.5dp</dimen>
+    <dimen name="call_detail_elevation">0.5dp</dimen>
     <dimen name="transcription_top_margin">18dp</dimen>
     <dimen name="transcription_bottom_margin">18dp</dimen>
 
diff --git a/src/com/android/dialer/CallDetailActivity.java b/src/com/android/dialer/CallDetailActivity.java
index c8a5356..a43ec3e 100644
--- a/src/com/android/dialer/CallDetailActivity.java
+++ b/src/com/android/dialer/CallDetailActivity.java
@@ -231,6 +231,9 @@
 
         mVoicemailUri = getIntent().getParcelableExtra(EXTRA_VOICEMAIL_URI);
 
+        ListView historyList = (ListView) findViewById(R.id.history);
+        historyList.addHeaderView(mInflater.inflate(R.layout.call_detail_header, null));
+
         mQuickContactBadge = (QuickContactBadge) findViewById(R.id.quick_contact_photo);
         mQuickContactBadge.setOverlay(null);
         mQuickContactBadge.setPrioritizedMimeType(Phone.CONTENT_ITEM_TYPE);