Merge "Remove one layer of overdraw from cards"
diff --git a/res/drawable/quickcontact_card_border.xml b/res/drawable/quickcontact_card_border.xml
new file mode 100644
index 0000000..f0daea1
--- /dev/null
+++ b/res/drawable/quickcontact_card_border.xml
@@ -0,0 +1,21 @@
+<?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.
+-->
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+    <stroke
+        android:width="@dimen/expanding_entry_card_border_width"
+        android:color="@color/card_margin_color"/>
+</shape>
diff --git a/res/layout/quickcontact_content.xml b/res/layout/quickcontact_content.xml
index b5b2a83..4f2d3d8 100644
--- a/res/layout/quickcontact_content.xml
+++ b/res/layout/quickcontact_content.xml
@@ -18,8 +18,7 @@
     android:layout_width="match_parent"
     android:layout_height="match_parent"
     android:fillViewport="true"
-    android:id="@+id/content_scroller"
-    android:background="@color/card_margin_color">
+    android:id="@+id/content_scroller">
 
     <!-- All the cards should be inserted into this LinearLayout -->
     <LinearLayout
@@ -27,16 +26,36 @@
         android:layout_height="match_parent"
         android:orientation="vertical"
         android:id="@+id/card_container">
-        <com.android.contacts.quickcontact.ExpandingEntryCardView
-            style="@style/ExpandingEntryCardStyle"
-            android:id="@+id/communication_card"
-            android:layout_marginTop="@dimen/communication_card_marginTop"
-            android:visibility="gone" />
 
-        <com.android.contacts.quickcontact.ExpandingEntryCardView
-            style="@style/ExpandingEntryCardStyle"
-            android:id="@+id/recent_card"
-            android:visibility="gone" />
+        <!-- We cannot set the border directly on ExpandingEntryCardView without it looking
+             funny because of the card's elevation value. So we need a parent FrameLayout -->
+        <FrameLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/quickcontact_card_border">
+            <com.android.contacts.quickcontact.ExpandingEntryCardView
+                style="@style/ExpandingEntryCardStyle"
+                android:id="@+id/communication_card"
+                android:layout_marginTop="@dimen/communication_card_marginTop"
+                android:visibility="gone" />
+        </FrameLayout>
+
+        <FrameLayout
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
+            android:background="@drawable/quickcontact_card_border">
+            <com.android.contacts.quickcontact.ExpandingEntryCardView
+                style="@style/ExpandingEntryCardStyle"
+                android:id="@+id/recent_card"
+                android:visibility="gone" />
+        </FrameLayout>
+
+        <!-- Fill the rest of the LinearLayout with the correct background color -->
+        <View
+            android:layout_width="match_parent"
+            android:layout_height="match_parent"
+            android:background="@color/card_margin_color" />
+
     </LinearLayout>
 
 </com.android.contacts.widget.TouchlessScrollView>
\ No newline at end of file
diff --git a/res/values/dimens.xml b/res/values/dimens.xml
index 5a2f7ab..79dd5d6 100644
--- a/res/values/dimens.xml
+++ b/res/values/dimens.xml
@@ -147,6 +147,9 @@
     <dimen name="expanding_entry_card_marginStart">12dp</dimen>
     <dimen name="expanding_entry_card_marginEnd">12dp</dimen>
     <dimen name="expanding_entry_card_marginBottom">12dp</dimen>
+    <!-- Width of the grey border surrounding the expanding entry cards. If we ever add
+         a rounded corner to the expanding entry cards, than we will need to increase this value -->
+    <dimen name="expanding_entry_card_border_width">12dp</dimen>
 
     <!-- Top margin for the communication card, used to add space from header. -->
     <dimen name="communication_card_marginTop">12dp</dimen>