Fix overdraw in PeopleActivity

Remove window background in onCreate. Add and remove various view
backgrounds to reduce overdraw.

Bug: 7267295
Change-Id: I868f194f2e91be1011268faa454dfd1278510b8b
diff --git a/res/drawable/background_holo_light.xml b/res/drawable/background_holo_light.xml
new file mode 100644
index 0000000..4e863ea
--- /dev/null
+++ b/res/drawable/background_holo_light.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2012 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">
+    <gradient
+            android:startColor="#ffe8e8e8"
+            android:endColor="#ffffffff"
+            android:angle="270" />
+</shape>
diff --git a/res/layout-sw580dp-land/contact_detail_fragment.xml b/res/layout-sw580dp-land/contact_detail_fragment.xml
index 9f32584..d4fde29 100644
--- a/res/layout-sw580dp-land/contact_detail_fragment.xml
+++ b/res/layout-sw580dp-land/contact_detail_fragment.xml
@@ -19,8 +19,7 @@
     android:id="@+id/contact_detail"
     android:orientation="vertical"
     android:layout_width="match_parent"
-    android:layout_height="match_parent"
-    android:background="@color/background_primary">
+    android:layout_height="match_parent">
 
     <!-- Placeholder for empty list -->
     <include
diff --git a/res/layout-sw580dp-land/people_activity.xml b/res/layout-sw580dp-land/people_activity.xml
index 1026951..6e7133f 100644
--- a/res/layout-sw580dp-land/people_activity.xml
+++ b/res/layout-sw580dp-land/people_activity.xml
@@ -85,7 +85,6 @@
             android:layout_width="0dip"
             android:layout_height="match_parent"
             android:layout_weight="2"
-            android:background="@color/background_primary"
             android:visibility="gone">
 
             <!-- This is the group detail page -->
@@ -140,6 +139,7 @@
         android:id="@+id/contacts_unavailable_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:background="@drawable/background_holo_light"
         android:visibility="gone">
 
         <FrameLayout
diff --git a/res/layout-sw580dp/people_activity.xml b/res/layout-sw580dp/people_activity.xml
index e29b6b0..eecf38a 100644
--- a/res/layout-sw580dp/people_activity.xml
+++ b/res/layout-sw580dp/people_activity.xml
@@ -88,7 +88,6 @@
             android:layout_width="0dip"
             android:layout_height="match_parent"
             android:layout_weight="2"
-            android:background="@color/background_primary"
             android:visibility="gone">
 
             <!-- This is the group detail page -->
@@ -104,7 +103,8 @@
         <FrameLayout
             android:id="@+id/favorites_view"
             android:layout_width="match_parent"
-            android:layout_height="match_parent">
+            android:layout_height="match_parent"
+            android:background="@color/background_primary">
 
             <fragment
                 android:id="@+id/favorites_fragment"
@@ -122,6 +122,7 @@
         android:id="@+id/contacts_unavailable_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:background="@drawable/background_holo_light"
         android:visibility="gone">
 
         <FrameLayout
diff --git a/res/layout-sw680dp-land/contact_detail_fragment.xml b/res/layout-sw680dp-land/contact_detail_fragment.xml
index b3f13a6..00a3ab1 100644
--- a/res/layout-sw680dp-land/contact_detail_fragment.xml
+++ b/res/layout-sw680dp-land/contact_detail_fragment.xml
@@ -20,7 +20,6 @@
     android:orientation="vertical"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/background_primary"
     android:paddingLeft="16dip">
 
     <!-- Placeholder for empty list -->
diff --git a/res/layout-sw680dp-land/people_activity.xml b/res/layout-sw680dp-land/people_activity.xml
index ae7bc0d..d942796 100644
--- a/res/layout-sw680dp-land/people_activity.xml
+++ b/res/layout-sw680dp-land/people_activity.xml
@@ -64,6 +64,7 @@
             ex:layout_wideParentWidth="1280dip"
             ex:layout_wideMarginLeft="0dip"
             ex:layout_wideMarginRight="0dip"
+            android:background="@color/background_primary"
             android:visibility="gone">
 
             <!-- This layout includes all possible views needed for a contact detail page -->
@@ -146,6 +147,7 @@
         android:id="@+id/contacts_unavailable_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:background="@drawable/background_holo_light"
         android:visibility="gone">
 
         <FrameLayout
diff --git a/res/layout-sw680dp/people_activity.xml b/res/layout-sw680dp/people_activity.xml
index 59b4869..fbd4312 100644
--- a/res/layout-sw680dp/people_activity.xml
+++ b/res/layout-sw680dp/people_activity.xml
@@ -88,7 +88,6 @@
             android:layout_width="0dip"
             android:layout_height="match_parent"
             android:layout_weight="1"
-            android:background="@color/background_primary"
             android:visibility="gone">
 
             <!-- This is the group detail page -->
@@ -143,6 +142,7 @@
         android:id="@+id/contacts_unavailable_view"
         android:layout_width="match_parent"
         android:layout_height="match_parent"
+        android:background="@drawable/background_holo_light"
         android:visibility="gone">
 
         <FrameLayout
diff --git a/res/layout/people_activity.xml b/res/layout/people_activity.xml
index 589e4a9..8ad36ba 100644
--- a/res/layout/people_activity.xml
+++ b/res/layout/people_activity.xml
@@ -17,7 +17,8 @@
 <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:id="@+id/list_container"
     android:layout_width="match_parent"
-    android:layout_height="match_parent">
+    android:layout_height="match_parent"
+    android:background="@color/background_primary">
 
     <!--
         ViewPager for swiping between tabs.  We put StrequentContactListFragment,
diff --git a/src/com/android/contacts/activities/PeopleActivity.java b/src/com/android/contacts/activities/PeopleActivity.java
index 019eacd..3a3bdc3 100644
--- a/src/com/android/contacts/activities/PeopleActivity.java
+++ b/src/com/android/contacts/activities/PeopleActivity.java
@@ -256,7 +256,6 @@
             finish();
             return;
         }
-
         mContactListFilterController = ContactListFilterController.getInstance(this);
         mContactListFilterController.checkFilterValidity(false);
         mContactListFilterController.addListener(this);
@@ -265,6 +264,7 @@
 
         mIsRecreatedInstance = (savedState != null);
         createViewsAndFragments(savedState);
+        getWindow().setBackgroundDrawable(null);
         if (Log.isLoggable(Constants.PERFORMANCE_TAG, Log.DEBUG)) {
             Log.d(Constants.PERFORMANCE_TAG, "PeopleActivity.onCreate finish");
         }