Makes the call details scrollable.

This change makes the call detail activity scrollable, making it easier
to see the details of multiple calls.

In order to make sure the main controls are always visible, it only
scrolls out the picture view, but always keeps the rest in view.

Bug: 5041805
Change-Id: I40b87efecfe3c921aab831e83dbff806b10b9c9f
diff --git a/src/com/android/contacts/CallDetailActivity.java b/src/com/android/contacts/CallDetailActivity.java
index 14b38b9..aa52d91 100644
--- a/src/com/android/contacts/CallDetailActivity.java
+++ b/src/com/android/contacts/CallDetailActivity.java
@@ -16,6 +16,7 @@
 
 package com.android.contacts;
 
+import com.android.contacts.BackScrollManager.ScrollableHeader;
 import com.android.contacts.calllog.CallDetailHistoryAdapter;
 import com.android.contacts.calllog.CallTypeHelper;
 import com.android.contacts.calllog.PhoneNumberHelper;
@@ -434,7 +435,25 @@
                 ListView historyList = (ListView) findViewById(R.id.history);
                 historyList.setAdapter(
                         new CallDetailHistoryAdapter(CallDetailActivity.this, mInflater,
-                                mCallTypeHelper, details));
+                                mCallTypeHelper, details, hasVoicemail(), canPlaceCallsTo));
+                BackScrollManager.bind(
+                        new ScrollableHeader() {
+                            private View controls = findViewById(R.id.controls);
+                            private View photo = findViewById(R.id.contact_background_sizer);
+                            private View nameHeader = findViewById(R.id.photo_text_bar);
+
+                            @Override
+                            public void setOffset(int offset) {
+                                controls.setY(-offset);
+                            }
+
+                            @Override
+                            public int getMaximumScrollableHeaderOffset() {
+                                // We can scroll the photo out, but we should keep the header.
+                                return photo.getHeight() - nameHeader.getHeight();
+                            }
+                        },
+                        historyList);
                 loadContactPhotos(photoUri);
                 findViewById(R.id.call_detail).setVisibility(View.VISIBLE);
             }