Increase max QC title size on 720dp+ tablets

Because of the way that View#setScaleY() works, the maximum size of the
title TextView has to be less than the minimum size of the of the TextView's
parent. As a result, increasing the title size caused unexpected behavior.

Fixing this odd behavior required me to remove the title TextView
out of the header ViewGroup and instead manually control its position
inside MultiShrinkScroller. This required me to make MultiShrinkScroller
a FrameLayout. This necessitated lots of little changes inside MultiShrinkScroller
(ie, what type of LayoutParams to cast into).

There is a reason nobody else has messed around with scaling title TextViews.

Bug: 16683381
Change-Id: Ib8fc065931a6a0c2a96b8bd5a11bb055457aa3dd
diff --git a/res/layout-land/quickcontact_activity.xml b/res/layout-land/quickcontact_activity.xml
index 9a07698..b22b5ef 100644
--- a/res/layout-land/quickcontact_activity.xml
+++ b/res/layout-land/quickcontact_activity.xml
@@ -23,19 +23,39 @@
     android:focusableInTouchMode="true"
     android:descendantFocusability="afterDescendants" >
 
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/quickcontact_starting_empty_height"
-        android:contentDescription="@string/quickcontact_transparent_view_description"
-        android:id="@+id/transparent_view" />
-
     <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="match_parent">
+        android:layout_height="match_parent"
+        android:orientation="vertical">
 
-        <include layout="@layout/quickcontact_header" />
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/quickcontact_starting_empty_height"
+            android:contentDescription="@string/quickcontact_transparent_view_description"
+            android:id="@+id/transparent_view" />
 
-        <include layout="@layout/quickcontact_content" />
+        <LinearLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:orientation="horizontal">
+
+            <!-- Needs a non null background for elevation to work on this View. This will
+                 *not* cause an additional draw since the background is transparent. -->
+            <FrameLayout
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:background="#00000000"
+                android:id="@+id/toolbar_parent">
+
+                <include layout="@layout/quickcontact_header" />
+
+                <include layout="@layout/quickcontact_title" />
+
+            </FrameLayout>
+
+            <include layout="@layout/quickcontact_content" />
+
+        </LinearLayout>
 
     </LinearLayout>
 
diff --git a/res/layout/quickcontact_activity.xml b/res/layout/quickcontact_activity.xml
index 008062b..577a451 100644
--- a/res/layout/quickcontact_activity.xml
+++ b/res/layout/quickcontact_activity.xml
@@ -24,14 +24,34 @@
     android:focusableInTouchMode="true"
     android:descendantFocusability="afterDescendants" >
 
-    <View
+    <LinearLayout
         android:layout_width="match_parent"
-        android:layout_height="@dimen/quickcontact_starting_empty_height"
-        android:contentDescription="@string/quickcontact_transparent_view_description"
-        android:id="@+id/transparent_view" />
+        android:layout_height="match_parent"
+        android:orientation="vertical">
 
-    <include layout="@layout/quickcontact_header" />
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="@dimen/quickcontact_starting_empty_height"
+            android:contentDescription="@string/quickcontact_transparent_view_description"
+            android:id="@+id/transparent_view" />
 
-    <include layout="@layout/quickcontact_content" />
+        <!-- Needs a non null background for elevation to work on this View. This will *not*
+             cause an additional draw since the background is transparent. -->
+        <FrameLayout
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="#00000000"
+            android:id="@+id/toolbar_parent">
+            <include layout="@layout/quickcontact_header" />
+        </FrameLayout>
+
+        <include layout="@layout/quickcontact_content" />
+
+    </LinearLayout>
+
+    <!-- This title's maximum height must be less than the minimum size of its
+         parent ViewGroup because of an oddity in the way View#setScaleY() works. As a result,
+         this title can not be inside @style/quickcontact_header. -->
+    <include layout="@layout/quickcontact_title" />
 
 </com.android.contacts.widget.MultiShrinkScroller>
\ No newline at end of file
diff --git a/res/layout/quickcontact_header.xml b/res/layout/quickcontact_header.xml
index 1f73215..bb89dda 100644
--- a/res/layout/quickcontact_header.xml
+++ b/res/layout/quickcontact_header.xml
@@ -14,15 +14,7 @@
      See the License for the specific language governing permissions and
      limitations under the License.
 -->
-
-<!-- Needs a non null background in for elevation to work on this View. This will *not* cause an
-     additional draw since the background is transparent. -->
-<FrameLayout
-    xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="#00000000"
-    android:id="@+id/toolbar_parent">
+<merge xmlns:android="http://schemas.android.com/apk/res/android">
 
     <com.android.contacts.widget.QuickContactImageView
         android:id="@+id/photo"
@@ -61,17 +53,4 @@
         android:background="#00000000"
         android:id="@+id/toolbar"/>
 
-    <TextView
-        android:layout_width="wrap_content"
-        android:layout_height="wrap_content"
-        android:textColor="@color/actionbar_text_color"
-        android:maxLines="@integer/quickcontact_title_lines"
-        android:ellipsize="end"
-        android:layout_gravity="bottom|start"
-        android:textSize="@dimen/quickcontact_maximum_title_size"
-        android:layout_marginStart="@dimen/quickcontact_title_initial_margin"
-        android:layout_marginEnd="@dimen/quickcontact_title_initial_margin"
-        android:layout_marginBottom="@dimen/quickcontact_title_initial_margin"
-        android:id="@+id/large_title"/>
-
-</FrameLayout>
+</merge>
diff --git a/res/layout/quickcontact_title.xml b/res/layout/quickcontact_title.xml
new file mode 100644
index 0000000..9b23a86
--- /dev/null
+++ b/res/layout/quickcontact_title.xml
@@ -0,0 +1,29 @@
+<?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.
+-->
+<TextView
+    xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="wrap_content"
+    android:layout_height="wrap_content"
+    android:layout_marginStart="@dimen/quickcontact_title_initial_margin"
+    android:layout_marginEnd="@dimen/quickcontact_title_initial_margin"
+    android:layout_marginBottom="@dimen/quickcontact_title_initial_margin"
+    android:layout_gravity="top|start"
+    android:textColor="@color/actionbar_text_color"
+    android:maxLines="@integer/quickcontact_title_lines"
+    android:textSize="@dimen/quickcontact_maximum_title_size"
+    android:ellipsize="end"
+    android:id="@+id/large_title"/>
\ No newline at end of file
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 495526d..827c71b 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -21,4 +21,9 @@
     <dimen name="quick_contact_photo_container_height">360dip</dimen>
     <dimen name="contact_picker_contact_list_min_height">650dip</dimen>
     <dimen name="list_visible_scrollbar_padding">48dip</dimen>
+
+    <!-- When QC is uncollapsed, the title has this much margin on its left, right and bottom -->
+    <dimen name="quickcontact_title_initial_margin">32dp</dimen>
+    <!-- Initial size of QuickContact's title size -->
+    <dimen name="quickcontact_maximum_title_size">64dp</dimen>
 </resources>