Merge "Don't run the async query if being rendered in EditMode." into klp-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
bf3acff10a
@ -92,7 +92,9 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
com.android.internal.R.styleable.Theme_quickContactBadgeOverlay);
|
||||
styledAttributes.recycle();
|
||||
|
||||
mQueryHandler = new QueryHandler(mContext.getContentResolver());
|
||||
if (!isInEditMode()) {
|
||||
mQueryHandler = new QueryHandler(mContext.getContentResolver());
|
||||
}
|
||||
setOnClickListener(this);
|
||||
}
|
||||
|
||||
@ -199,7 +201,7 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
public void assignContactFromEmail(String emailAddress, boolean lazyLookup, Bundle extras) {
|
||||
mContactEmail = emailAddress;
|
||||
mExtras = extras;
|
||||
if (!lazyLookup) {
|
||||
if (!lazyLookup && mQueryHandler != null) {
|
||||
mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP, null,
|
||||
Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(mContactEmail)),
|
||||
EMAIL_LOOKUP_PROJECTION, null, null, null);
|
||||
@ -239,7 +241,7 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
public void assignContactFromPhone(String phoneNumber, boolean lazyLookup, Bundle extras) {
|
||||
mContactPhone = phoneNumber;
|
||||
mExtras = extras;
|
||||
if (!lazyLookup) {
|
||||
if (!lazyLookup && mQueryHandler != null) {
|
||||
mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP, null,
|
||||
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
|
||||
PHONE_LOOKUP_PROJECTION, null, null, null);
|
||||
@ -262,12 +264,12 @@ public class QuickContactBadge extends ImageView implements OnClickListener {
|
||||
if (mContactUri != null) {
|
||||
QuickContact.showQuickContact(getContext(), QuickContactBadge.this, mContactUri,
|
||||
QuickContact.MODE_LARGE, mExcludeMimes);
|
||||
} else if (mContactEmail != null) {
|
||||
} else if (mContactEmail != null && mQueryHandler != null) {
|
||||
extras.putString(EXTRA_URI_CONTENT, mContactEmail);
|
||||
mQueryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
|
||||
Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(mContactEmail)),
|
||||
EMAIL_LOOKUP_PROJECTION, null, null, null);
|
||||
} else if (mContactPhone != null) {
|
||||
} else if (mContactPhone != null && mQueryHandler != null) {
|
||||
extras.putString(EXTRA_URI_CONTENT, mContactPhone);
|
||||
mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP_AND_TRIGGER, extras,
|
||||
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
|
||||
|
Reference in New Issue
Block a user