Merge "New QuickContactBadge holo style." into honeycomb
@@ -258155,7 +258155,7 @@
|
||||
deprecated="not deprecated"
|
||||
visibility="public"
|
||||
>
|
||||
<parameter name="arg0" type="T">
|
||||
<parameter name="t" type="T">
|
||||
</parameter>
|
||||
</method>
|
||||
</interface>
|
||||
|
||||
@@ -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 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
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 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
|
||||
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 class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
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 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
/**
|
||||
* 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 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
|
||||
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);
|
||||
|
||||
|
After Width: | Height: | Size: 303 B |
|
After Width: | Height: | Size: 305 B |
|
After Width: | Height: | Size: 593 B |
|
After Width: | Height: | Size: 600 B |
|
Before Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 3.1 KiB |
|
Before Width: | Height: | Size: 1019 B |
|
Before Width: | Height: | Size: 291 B |
|
Before Width: | Height: | Size: 312 B |
|
Before Width: | Height: | Size: 317 B |
|
Before Width: | Height: | Size: 309 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 254 B |
|
After Width: | Height: | Size: 463 B |
|
After Width: | Height: | Size: 466 B |
|
Before Width: | Height: | Size: 650 B |
|
Before Width: | Height: | Size: 605 B |
|
Before Width: | Height: | Size: 609 B |
|
Before Width: | Height: | Size: 651 B |
|
Before Width: | Height: | Size: 1016 B |
@@ -19,10 +19,10 @@
|
||||
android:state_focused="false"
|
||||
android:state_selected="false"
|
||||
android:state_pressed="false"
|
||||
android:drawable="@drawable/quickcontact_badge_unpressed" />
|
||||
android:drawable="@drawable/quickcontact_badge_overlay_normal_dark" />
|
||||
|
||||
<item
|
||||
android:state_pressed="true"
|
||||
android:drawable="@drawable/quickcontact_badge_pressed" />
|
||||
android:drawable="@drawable/quickcontact_badge_overlay_pressed_dark" />
|
||||
|
||||
</selector>
|
||||
@@ -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>
|
||||
@@ -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. -->
|
||||
|
||||
@@ -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">
|
||||
|
||||
@@ -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>
|
||||
|
||||
|
||||