Merge "New QuickContactBadge holo style." into honeycomb
diff --git a/api/current.xml b/api/current.xml
index d790c4f..41e7456 100644
--- a/api/current.xml
+++ b/api/current.xml
@@ -258155,7 +258155,7 @@
  deprecated="not deprecated"
  visibility="public"
 >
-<parameter name="arg0" type="T">
+<parameter name="t" type="T">
 </parameter>
 </method>
 </interface>
diff --git a/core/java/android/widget/QuickContactBadge.java b/core/java/android/widget/QuickContactBadge.java
index 5598c65..bc89507 100644
--- a/core/java/android/widget/QuickContactBadge.java
+++ b/core/java/android/widget/QuickContactBadge.java
@@ -16,24 +16,26 @@
 
 package android.widget;
 
+import com.android.internal.R;
+
 import android.content.AsyncQueryHandler;
 import android.content.ContentResolver;
 import android.content.Context;
 import android.content.Intent;
 import android.content.res.TypedArray;
 import android.database.Cursor;
+import android.graphics.Canvas;
 import android.graphics.drawable.Drawable;
 import android.net.Uri;
+import android.provider.ContactsContract.CommonDataKinds.Email;
 import android.provider.ContactsContract.Contacts;
 import android.provider.ContactsContract.Intents;
 import android.provider.ContactsContract.PhoneLookup;
 import android.provider.ContactsContract.QuickContact;
 import android.provider.ContactsContract.RawContacts;
-import android.provider.ContactsContract.CommonDataKinds.Email;
 import android.util.AttributeSet;
 import android.view.View;
 import android.view.View.OnClickListener;
-import com.android.internal.R;
 
 /**
  * Widget used to show an image with the standard QuickContact badge
@@ -45,6 +47,7 @@
     private String mContactEmail;
     private String mContactPhone;
     private int mMode;
+    private Drawable mOverlay;
     private QueryHandler mQueryHandler;
     private Drawable mBadgeBackground;
     private Drawable mNoBadgeBackground;
@@ -100,6 +103,10 @@
 
         a.recycle();
 
+        TypedArray styledAttributes = mContext.obtainStyledAttributes(R.styleable.Theme);
+        mOverlay = styledAttributes.getDrawable(com.android.internal.R.styleable.Theme_quickContactBadgeOverlay);
+        styledAttributes.recycle();
+
         init();
 
         mBadgeBackground = getBackground();
@@ -118,7 +125,28 @@
     public void setMode(int size) {
         mMode = size;
     }
-    
+
+    @Override
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+
+        if (mOverlay == null || mOverlay.getIntrinsicWidth() == 0 || mOverlay.getIntrinsicHeight() == 0) {
+            return; // nothing to draw
+        }
+
+        mOverlay.setBounds(0, 0, getWidth(), getHeight());
+
+        if (mPaddingTop == 0 && mPaddingLeft == 0) {
+            mOverlay.draw(canvas);
+        } else {
+            int saveCount = canvas.getSaveCount();
+            canvas.save();
+            canvas.translate(mPaddingLeft, mPaddingTop);
+            mOverlay.draw(canvas);
+            canvas.restoreToCount(saveCount);
+        }
+    }
+
     /**
      * Resets the contact photo to the default state.
      */
@@ -132,7 +160,8 @@
     /**
      * Assign the contact uri that this QuickContactBadge should be associated
      * with. Note that this is only used for displaying the QuickContact window and
-     * won't bind the contact's photo for you.
+     * won't bind the contact's photo for you. Call {@link #setImageDrawable(Drawable)} to set the
+     * photo.
      *
      * @param contactUri Either a {@link Contacts#CONTENT_URI} or
      *            {@link Contacts#CONTENT_LOOKUP_URI} style URI.
@@ -146,9 +175,12 @@
 
     private void onContactUriChanged() {
         if (mContactUri == null && mContactEmail == null && mContactPhone == null) {
+            // Holo theme has no background on badges. Use a null background.
+            /*
             if (mNoBadgeBackground == null) {
                 mNoBadgeBackground = getResources().getDrawable(R.drawable.quickcontact_nobadge);
             }
+            */
             setBackgroundDrawable(mNoBadgeBackground);
         } else {
             setBackgroundDrawable(mBadgeBackground);
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_dark.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_dark.9.png
new file mode 100644
index 0000000..a2264ec
--- /dev/null
+++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_light.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_light.9.png
new file mode 100644
index 0000000..9dd657f
--- /dev/null
+++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_normal_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_dark.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_dark.9.png
new file mode 100644
index 0000000..7e7a164
--- /dev/null
+++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_light.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_light.9.png
new file mode 100644
index 0000000..45a5e30
--- /dev/null
+++ b/core/res/res/drawable-hdpi/quickcontact_badge_overlay_pressed_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_pressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_pressed.9.png
deleted file mode 100644
index 75c8162..0000000
--- a/core/res/res/drawable-hdpi/quickcontact_badge_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png
deleted file mode 100644
index aebfa29..0000000
--- a/core/res/res/drawable-hdpi/quickcontact_badge_small_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png
deleted file mode 100644
index ed416f1..0000000
--- a/core/res/res/drawable-hdpi/quickcontact_badge_small_unpressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_badge_unpressed.9.png b/core/res/res/drawable-hdpi/quickcontact_badge_unpressed.9.png
deleted file mode 100644
index d063229..0000000
--- a/core/res/res/drawable-hdpi/quickcontact_badge_unpressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-hdpi/quickcontact_nobadge.9.png b/core/res/res/drawable-hdpi/quickcontact_nobadge.9.png
deleted file mode 100644
index 68d43c4..0000000
--- a/core/res/res/drawable-hdpi/quickcontact_nobadge.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-ldpi/quickcontact_badge_pressed.9.png b/core/res/res/drawable-ldpi/quickcontact_badge_pressed.9.png
deleted file mode 100644
index ff43fed..0000000
--- a/core/res/res/drawable-ldpi/quickcontact_badge_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-ldpi/quickcontact_badge_small_pressed.9.png b/core/res/res/drawable-ldpi/quickcontact_badge_small_pressed.9.png
deleted file mode 100644
index 5aedb70..0000000
--- a/core/res/res/drawable-ldpi/quickcontact_badge_small_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-ldpi/quickcontact_badge_small_unpressed.9.png b/core/res/res/drawable-ldpi/quickcontact_badge_small_unpressed.9.png
deleted file mode 100644
index 6e212b6..0000000
--- a/core/res/res/drawable-ldpi/quickcontact_badge_small_unpressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-ldpi/quickcontact_badge_unpressed.9.png b/core/res/res/drawable-ldpi/quickcontact_badge_unpressed.9.png
deleted file mode 100644
index 417c11b..0000000
--- a/core/res/res/drawable-ldpi/quickcontact_badge_unpressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_dark.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_dark.9.png
new file mode 100644
index 0000000..9626ab9
--- /dev/null
+++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_light.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_light.9.png
new file mode 100644
index 0000000..3876d3b
--- /dev/null
+++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_normal_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_dark.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_dark.9.png
new file mode 100644
index 0000000..db12ac6
--- /dev/null
+++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_dark.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_light.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_light.9.png
new file mode 100644
index 0000000..b3a49fc
--- /dev/null
+++ b/core/res/res/drawable-mdpi/quickcontact_badge_overlay_pressed_light.9.png
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_pressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_pressed.9.png
deleted file mode 100644
index c8ca33a..0000000
--- a/core/res/res/drawable-mdpi/quickcontact_badge_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png
deleted file mode 100644
index b23e921..0000000
--- a/core/res/res/drawable-mdpi/quickcontact_badge_small_pressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png
deleted file mode 100644
index 38f14f7..0000000
--- a/core/res/res/drawable-mdpi/quickcontact_badge_small_unpressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_badge_unpressed.9.png b/core/res/res/drawable-mdpi/quickcontact_badge_unpressed.9.png
deleted file mode 100644
index d8dff34..0000000
--- a/core/res/res/drawable-mdpi/quickcontact_badge_unpressed.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable-mdpi/quickcontact_nobadge.9.png b/core/res/res/drawable-mdpi/quickcontact_nobadge.9.png
deleted file mode 100644
index ebe747b..0000000
--- a/core/res/res/drawable-mdpi/quickcontact_nobadge.9.png
+++ /dev/null
Binary files differ
diff --git a/core/res/res/drawable/quickcontact_badge.xml b/core/res/res/drawable/quickcontact_badge.xml
deleted file mode 100644
index bd5aeb6..0000000
--- a/core/res/res/drawable/quickcontact_badge.xml
+++ /dev/null
@@ -1,28 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!-- Copyright (C) 2009 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.
--->
-
-<selector xmlns:android="http://schemas.android.com/apk/res/android">
-    <item
-        android:state_focused="false"
-        android:state_selected="false"
-        android:state_pressed="false"
-        android:drawable="@drawable/quickcontact_badge_unpressed" />
-
-    <item
-        android:state_pressed="true"
-        android:drawable="@drawable/quickcontact_badge_pressed" />
-
-</selector>
diff --git a/core/res/res/drawable/quickcontact_badge_small.xml b/core/res/res/drawable/quickcontact_badge_overlay_dark.xml
similarity index 85%
rename from core/res/res/drawable/quickcontact_badge_small.xml
rename to core/res/res/drawable/quickcontact_badge_overlay_dark.xml
index a38ba1e..972488d 100644
--- a/core/res/res/drawable/quickcontact_badge_small.xml
+++ b/core/res/res/drawable/quickcontact_badge_overlay_dark.xml
@@ -19,10 +19,10 @@
         android:state_focused="false"
         android:state_selected="false"
         android:state_pressed="false"
-        android:drawable="@drawable/quickcontact_badge_small_unpressed" />
+        android:drawable="@drawable/quickcontact_badge_overlay_normal_dark" />
 
     <item
         android:state_pressed="true"
-        android:drawable="@drawable/quickcontact_badge_small_pressed" />
+        android:drawable="@drawable/quickcontact_badge_overlay_pressed_dark" />
 
 </selector>
diff --git a/core/res/res/drawable/quickcontact_badge_small.xml b/core/res/res/drawable/quickcontact_badge_overlay_light.xml
similarity index 84%
copy from core/res/res/drawable/quickcontact_badge_small.xml
copy to core/res/res/drawable/quickcontact_badge_overlay_light.xml
index a38ba1e..bf95d52 100644
--- a/core/res/res/drawable/quickcontact_badge_small.xml
+++ b/core/res/res/drawable/quickcontact_badge_overlay_light.xml
@@ -19,10 +19,10 @@
         android:state_focused="false"
         android:state_selected="false"
         android:state_pressed="false"
-        android:drawable="@drawable/quickcontact_badge_small_unpressed" />
+        android:drawable="@drawable/quickcontact_badge_overlay_normal_light" />
 
     <item
         android:state_pressed="true"
-        android:drawable="@drawable/quickcontact_badge_small_pressed" />
+        android:drawable="@drawable/quickcontact_badge_overlay_pressed_light" />
 
 </selector>
diff --git a/core/res/res/values/attrs.xml b/core/res/res/values/attrs.xml
index c297751..3a3ca36 100755
--- a/core/res/res/values/attrs.xml
+++ b/core/res/res/values/attrs.xml
@@ -491,8 +491,8 @@
         <attr name="spinnerItemStyle" format="reference" />
         <!-- Default MapView style. -->
         <attr name="mapViewStyle" format="reference" />
-        <!-- Default quickcontact badge style. -->
-        <attr name="quickContactBadgeStyle" format="reference" />
+        <!-- Drawable used as an overlay on top of quickcontact photos. -->
+        <attr name="quickContactBadgeOverlay" format="reference" />
         <!-- Default quickcontact badge style with small quickcontact window. -->
         <attr name="quickContactBadgeStyleWindowSmall" format="reference" />
         <!-- Default quickcontact badge style with medium quickcontact window. -->
diff --git a/core/res/res/values/styles.xml b/core/res/res/values/styles.xml
index b8beda6b..f52be0d 100644
--- a/core/res/res/values/styles.xml
+++ b/core/res/res/values/styles.xml
@@ -658,21 +658,21 @@
         <item name="android:shadowRadius">2.75</item>
     </style>
 
-    <style name="Widget.QuickContactBadge">
-        <item name="android:layout_width">47.33333dip</item>
-        <item name="android:layout_height">56dip</item>
-        <item name="android:background">@android:drawable/quickcontact_badge</item>
+    <style name="Widget.GenericQuickContactBadge">
+        <item name="android:background">@null</item>
         <item name="android:clickable">true</item>
         <item name="android:scaleType">fitCenter</item>
         <item name="android:src">@android:drawable/ic_contact_picture</item>
     </style>
+
+    <style name="Widget.QuickContactBadge" parent="Widget.GenericQuickContactBadge">
+        <item name="android:layout_width">64dip</item>
+        <item name="android:layout_height">64dip</item>
+    </style>
     
-    <style name="Widget.QuickContactBadgeSmall">
-        <item name="android:layout_width">39dip</item>
-        <item name="android:layout_height">42dip</item>
-        <item name="android:background">@android:drawable/quickcontact_badge_small</item>
-        <item name="android:clickable">true</item>
-        <item name="android:scaleType">fitCenter</item>
+    <style name="Widget.QuickContactBadgeSmall" parent="Widget.GenericQuickContactBadge">
+        <item name="android:layout_width">40dip</item>
+        <item name="android:layout_height">40dip</item>
     </style>
 
     <style name="Widget.QuickContactBadge.WindowSmall">
diff --git a/core/res/res/values/themes.xml b/core/res/res/values/themes.xml
index d40c857..d070c30 100644
--- a/core/res/res/values/themes.xml
+++ b/core/res/res/values/themes.xml
@@ -217,6 +217,7 @@
         <item name="spinnerItemStyle">@android:style/Widget.TextView.SpinnerItem</item>
         <item name="dropDownHintAppearance">@android:style/TextAppearance.Widget.DropDownHint</item>
         <item name="keyboardViewStyle">@android:style/Widget.KeyboardView</item>
+        <item name="quickContactBadgeOverlay">@android:drawable/quickcontact_badge_overlay_dark</item>
         <item name="quickContactBadgeStyleWindowSmall">@android:style/Widget.QuickContactBadge.WindowSmall</item>
         <item name="quickContactBadgeStyleWindowMedium">@android:style/Widget.QuickContactBadge.WindowMedium</item>
         <item name="quickContactBadgeStyleWindowLarge">@android:style/Widget.QuickContactBadge.WindowLarge</item>
@@ -341,6 +342,7 @@
         <item name="listChoiceBackgroundIndicator">@android:drawable/list_selected_background_light</item>
 
         <item name="activatedBackgroundIndicator">@android:drawable/activated_background_light</item>
+        <item name="quickContactBadgeOverlay">@android:drawable/quickcontact_badge_overlay_light</item>
 
         <item name="popupWindowStyle">@android:style/Widget.PopupWindow</item>