Merge "Turned the "copy local" command into a button under the contact detail view"
diff --git a/res/drawable-xlarge/directory_bg.9.png b/res/drawable-hdpi/directory_bg_holo.9.png
similarity index 100%
rename from res/drawable-xlarge/directory_bg.9.png
rename to res/drawable-hdpi/directory_bg_holo.9.png
Binary files differ
diff --git a/res/drawable-xlarge/list_item_divider.9.png b/res/drawable-hdpi/list_item_divider_holo.9.png
similarity index 100%
rename from res/drawable-xlarge/list_item_divider.9.png
rename to res/drawable-hdpi/list_item_divider_holo.9.png
Binary files differ
diff --git a/res/drawable-xlarge/section_header.9.png b/res/drawable-hdpi/section_header_holo.9.png
similarity index 100%
rename from res/drawable-xlarge/section_header.9.png
rename to res/drawable-hdpi/section_header_holo.9.png
Binary files differ
diff --git a/res/drawable-xlarge/directory_bg.9.png b/res/drawable-mdpi/directory_bg_holo.9.png
similarity index 100%
copy from res/drawable-xlarge/directory_bg.9.png
copy to res/drawable-mdpi/directory_bg_holo.9.png
Binary files differ
diff --git a/res/drawable-xlarge/list_item_divider.9.png b/res/drawable-mdpi/list_item_divider_holo.9.png
similarity index 100%
copy from res/drawable-xlarge/list_item_divider.9.png
copy to res/drawable-mdpi/list_item_divider_holo.9.png
Binary files differ
diff --git a/res/drawable-xlarge/section_header.9.png b/res/drawable-mdpi/section_header_holo.9.png
similarity index 100%
copy from res/drawable-xlarge/section_header.9.png
copy to res/drawable-mdpi/section_header_holo.9.png
Binary files differ
diff --git a/res/layout-xlarge/list_section.xml b/res/layout-xlarge/list_section.xml
index 84d6e43..c684a0f 100644
--- a/res/layout-xlarge/list_section.xml
+++ b/res/layout-xlarge/list_section.xml
@@ -19,7 +19,7 @@
     xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="37dip"
-    android:background="@drawable/section_header"
+    android:background="@drawable/section_header_holo"
     >
     <TextView
         android:id="@+id/header_text"
diff --git a/res/layout-xlarge/search_header.xml b/res/layout-xlarge/search_header.xml
index 138bfae..e543883 100644
--- a/res/layout-xlarge/search_header.xml
+++ b/res/layout-xlarge/search_header.xml
@@ -16,9 +16,9 @@
 
 <RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    style="DirectoryHeader"
     android:layout_width="match_parent"
-    android:layout_height="56dip"
-    android:background="@drawable/directory_bg">
+    android:layout_height="56dip">
     <TextView
         android:id="@+id/totalContactsText"
         android:layout_height="wrap_content"
diff --git a/res/layout/directory_header.xml b/res/layout/directory_header.xml
index 2516405..d0219a8 100644
--- a/res/layout/directory_header.xml
+++ b/res/layout/directory_header.xml
@@ -17,9 +17,9 @@
 <!-- Layout used for list section separators. -->
 <RelativeLayout
     xmlns:android="http://schemas.android.com/apk/res/android"
+    style="DirectoryHeader"
     android:layout_width="match_parent"
     android:layout_height="56dip"
-    android:background="@drawable/directory_bg"
     >
     <TextView
         android:id="@+id/count"
diff --git a/res/values-xlarge/styles.xml b/res/values-xlarge/styles.xml
index ae90321..1e06a44 100644
--- a/res/values-xlarge/styles.xml
+++ b/res/values-xlarge/styles.xml
@@ -20,6 +20,8 @@
         <item name="android:windowBackground">@drawable/contact_list_bg</item>
         <item name="android:windowContentOverlay">@null</item>
         <item name="android:actionBarStyle">@style/TransparentActionBarStyle</item>
+        <item name="section_header_background">@drawable/section_header_holo</item>
+        <item name="list_item_divider">@drawable/list_item_divider_holo</item>
         <item name="list_item_padding_top">0dip</item>
         <item name="list_item_padding_right">11dip</item>
         <item name="list_item_padding_bottom">0dip</item>
@@ -35,6 +37,8 @@
     </style>
 
     <style name="ContactPickerTheme" parent="@android:Theme.Dialog">
+        <item name="section_header_background">@drawable/section_header_holo</item>
+        <item name="list_item_divider">@drawable/list_item_divider_holo</item>
         <item name="list_item_padding_top">0dip</item>
         <item name="list_item_padding_right">11dip</item>
         <item name="list_item_padding_bottom">0dip</item>
@@ -66,4 +70,8 @@
     <style name="TransparentActionBarStyle" parent="android:Widget.Holo.Light.ActionBar">
         <item name="android:background">@null</item>
     </style>
+
+    <style name="DirectoryHeader" parent="ContactBrowserTheme">
+        <item name="android:background">@drawable/directory_bg_holo</item>
+    </style>
 </resources>
diff --git a/res/values/styles.xml b/res/values/styles.xml
index 29b60cb..b8d9c54 100644
--- a/res/values/styles.xml
+++ b/res/values/styles.xml
@@ -103,7 +103,8 @@
     <declare-styleable name="ContactListItemView">
         <!-- An attribute that specifies a custom drawable for the pressed state in the contact list-->
         <attr name="pressedBackground" format="reference"/>
-
+        <attr name="section_header_background" format="reference"/>
+        <attr name="list_item_divider" format="reference"/>
         <attr name="list_item_padding_top" format="dimension"/>
         <attr name="list_item_padding_right" format="dimension"/>
         <attr name="list_item_padding_bottom" format="dimension"/>
@@ -127,6 +128,8 @@
 
     <style name="ContactBrowserTheme" parent="@android:Theme">
         <item name="pressedBackground">@*android:drawable/list_selector_background</item>
+        <item name="section_header_background">@drawable/section_header</item>
+        <item name="list_item_divider">@drawable/list_item_divider</item>
         <item name="list_item_padding_top">4dip</item>
         <item name="list_item_padding_right">11dip</item>
         <item name="list_item_padding_bottom">4dip</item>
@@ -142,6 +145,8 @@
     </style>
 
     <style name="ContactPickerTheme" parent="@android:Theme">
+        <item name="section_header_background">@drawable/section_header</item>
+        <item name="list_item_divider">@drawable/list_item_divider</item>
         <item name="list_item_padding_top">4dip</item>
         <item name="list_item_padding_right">11dip</item>
         <item name="list_item_padding_bottom">4dip</item>
@@ -177,4 +182,8 @@
         <attr name="layout_wideLeftMargin" format="dimension"/>
         <attr name="layout_wideRightMargin" format="dimension"/>
     </declare-styleable>
+    
+    <style name="DirectoryHeader" parent="ContactBrowserTheme">
+        <item name="android:background">@drawable/directory_bg</item>
+    </style>
 </resources>
diff --git a/src/com/android/contacts/list/ContactListItemView.java b/src/com/android/contacts/list/ContactListItemView.java
index 1ccece4..68560e4 100644
--- a/src/com/android/contacts/list/ContactListItemView.java
+++ b/src/com/android/contacts/list/ContactListItemView.java
@@ -154,6 +154,10 @@
         a = getContext().obtainStyledAttributes(attrs,R.styleable.ContactListItemView);
         mPressedBackgroundDrawable = a.getDrawable(
                 R.styleable.ContactListItemView_pressedBackground);
+        mHeaderBackgroundDrawable = a.getDrawable(
+                R.styleable.ContactListItemView_section_header_background);
+        mHorizontalDividerDrawable = a.getDrawable(
+                R.styleable.ContactListItemView_list_item_divider);
         mVerticalDividerMargin = a.getDimensionPixelOffset(
                 R.styleable.ContactListItemView_list_item_vertical_divider_margin, 0);
         mPaddingTop = a.getDimensionPixelOffset(
@@ -180,6 +184,9 @@
                 R.styleable.ContactListItemView_list_item_prefix_highlight_color, Color.GREEN);
 
         a.recycle();
+
+        mHeaderBackgroundHeight = mHeaderBackgroundDrawable.getIntrinsicHeight();
+        mHorizontalDividerHeight = mHorizontalDividerDrawable.getIntrinsicHeight();
     }
 
     /**
@@ -254,14 +261,12 @@
         height = Math.max(height, mPhotoViewHeight + mPaddingBottom + mPaddingTop);
 
         if (mHorizontalDividerVisible) {
-            ensureHorizontalDivider();
             height += mHorizontalDividerHeight;
         }
 
         height = Math.max(height, mPreferredHeight);
 
         if (mHeaderVisible) {
-            ensureHeaderBackground();
             mHeaderTextView.measure(
                     MeasureSpec.makeMeasureSpec(mHeaderTextWidth, MeasureSpec.EXACTLY),
                     MeasureSpec.makeMeasureSpec(mHeaderBackgroundHeight, MeasureSpec.EXACTLY));
@@ -291,7 +296,6 @@
         }
 
         if (mHorizontalDividerVisible) {
-            ensureHorizontalDivider();
             mHorizontalDividerDrawable.setBounds(
                     0,
                     height - mHorizontalDividerHeight,
@@ -451,28 +455,6 @@
     }
 
     /**
-     * Loads the drawable for the horizontal divider if it has not yet been loaded.
-     */
-    private void ensureHorizontalDivider() {
-        if (mHorizontalDividerDrawable == null) {
-            mHorizontalDividerDrawable = mContext.getResources().getDrawable(
-                    R.drawable.list_item_divider);
-            mHorizontalDividerHeight = mHorizontalDividerDrawable.getIntrinsicHeight();
-        }
-    }
-
-    /**
-     * Loads the drawable for the header background if it has not yet been loaded.
-     */
-    private void ensureHeaderBackground() {
-        if (mHeaderBackgroundDrawable == null) {
-            mHeaderBackgroundDrawable = mContext.getResources().getDrawable(
-                    R.drawable.section_header);
-            mHeaderBackgroundHeight = mHeaderBackgroundDrawable.getIntrinsicHeight();
-        }
-    }
-
-    /**
      * Extracts width and height from the style
      */
     private void ensurePhotoViewSize() {