本文整理汇总了Java中android.provider.ContactsContract.QuickContact.showQuickContact方法的典型用法代码示例。如果您正苦于以下问题:Java QuickContact.showQuickContact方法的具体用法?Java QuickContact.showQuickContact怎么用?Java QuickContact.showQuickContact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.provider.ContactsContract.QuickContact
的用法示例。
在下文中一共展示了QuickContact.showQuickContact方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onClick
import android.provider.ContactsContract.QuickContact; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
// If contact has been assigned, extras should no longer be null, but do a null check
// anyway just in case assignContactFromPhone or Email was called with a null bundle or
// wasn't assigned previously.
final Bundle extras = (this.extras == null) ? new Bundle() : this.extras;
if (contactUri != null) {
QuickContact.showQuickContact(getContext(), ContactBadge.this, contactUri,
QuickContact.MODE_LARGE, null);
} else if (contactEmail != null) {
extras.putString(EXTRA_URI_CONTENT, contactEmail);
queryHandler.startQuery(TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(contactEmail)),
EMAIL_LOOKUP_PROJECTION, null, null, null);
}
}
示例2: onClick
import android.provider.ContactsContract.QuickContact; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
// If contact has been assigned, mExtras should no longer be null, but do a null check
// anyway just in case assignContactFromPhone or Email was called with a null bundle or
// wasn't assigned previously.
final Bundle extras = (mExtras == null) ? new Bundle() : mExtras;
if (mContactUri != null) {
QuickContact.showQuickContact(getContext(), ContactBadge.this, mContactUri, QuickContact.MODE_LARGE, mExcludeMimes);
} else if (mContactEmail != null && mQueryHandler != null) {
extras.putString(Constants.EXTRA_URI_CONTENT, mContactEmail);
mQueryHandler.startQuery(Constants.TOKEN_EMAIL_LOOKUP_AND_TRIGGER, extras,
Uri.withAppendedPath(Email.CONTENT_LOOKUP_URI, Uri.encode(mContactEmail)),
EMAIL_LOOKUP_PROJECTION, null, null, null, mContactQueryHandlerCallback);
} else if (mContactPhone != null && mQueryHandler != null) {
extras.putString(Constants.EXTRA_URI_CONTENT, mContactPhone);
mQueryHandler.startQuery(Constants.TOKEN_PHONE_LOOKUP_AND_TRIGGER, extras,
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
PHONE_LOOKUP_PROJECTION, null, null, null, mContactQueryHandlerCallback);
} else {
// If a contact hasn't been assigned, don't react to click.
return;
}
}
示例3: onClick
import android.provider.ContactsContract.QuickContact; //导入方法依赖的package包/类
@Override
public void onClick(View v) {
// If contact has been assigned, mExtras should no longer be null, but do a null check
// anyway just in case assignContactFromPhone or Email was called with a null bundle or
// wasn't assigned previously.
final Bundle extras = (mExtras == null) ? new Bundle() : mExtras;
if (mContactUri != null) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
QuickContact.showQuickContact(getContext(), QuickContactBadge.this, mContactUri,
mExcludeMimes, mPrioritizedMimeType);
} else {
QuickContact.showQuickContact(getContext(), QuickContactBadge.this, mContactUri,
QuickContact.MODE_LARGE, mExcludeMimes);
}
} 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 && mQueryHandler != null) {
extras.putString(EXTRA_URI_CONTENT, mContactPhone);
mQueryHandler.startQuery(TOKEN_PHONE_LOOKUP_AND_TRIGGER, extras,
Uri.withAppendedPath(PhoneLookup.CONTENT_FILTER_URI, mContactPhone),
PHONE_LOOKUP_PROJECTION, null, null, null);
} else {
// If a contact hasn't been assigned, don't react to click.
return;
}
}
示例4: showContactInfo
import android.provider.ContactsContract.QuickContact; //导入方法依赖的package包/类
/**
* Taken from com.google.android.gm.HtmlConversationActivity
*
* Send the intent that shows the Contact info corresponding to the email
* address.
*/
public void showContactInfo(Attendee attendee, Rect rect) {
// First perform lookup query to find existing contact
final ContentResolver resolver = getActivity().getContentResolver();
final String address = attendee.mEmail;
final Uri dataUri = Uri.withAppendedPath(
CommonDataKinds.Email.CONTENT_FILTER_URI, Uri.encode(address));
final Uri lookupUri = ContactsContract.Data.getContactLookupUri(
resolver, dataUri);
if (lookupUri != null) {
// Found matching contact, trigger QuickContact
QuickContact.showQuickContact(getActivity(), rect, lookupUri,
QuickContact.MODE_MEDIUM, null);
} else {
// No matching contact, ask user to create one
final Uri mailUri = Uri.fromParts("mailto", address, null);
final Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT,
mailUri);
// Pass along full E-mail string for possible create dialog
Rfc822Token sender = new Rfc822Token(attendee.mName,
attendee.mEmail, null);
intent.putExtra(Intents.EXTRA_CREATE_DESCRIPTION, sender.toString());
// Only provide personal name hint if we have one
final String senderPersonal = attendee.mName;
if (!TextUtils.isEmpty(senderPersonal)) {
intent.putExtra(Intents.Insert.NAME, senderPersonal);
}
startActivity(intent);
}
}
示例5: onQueryComplete
import android.provider.ContactsContract.QuickContact; //导入方法依赖的package包/类
@Override
protected void onQueryComplete(int token, Object cookie, Cursor cursor) {
Uri lookupUri = null;
Uri createUri = null;
boolean trigger = false;
Bundle extras = (cookie != null) ? (Bundle) cookie : new Bundle();
try {
switch (token) {
case TOKEN_EMAIL_LOOKUP_AND_TRIGGER:
trigger = true;
createUri = Uri.fromParts("mailto",
extras.getString(EXTRA_URI_CONTENT), null);
//$FALL-THROUGH$
case TOKEN_EMAIL_LOOKUP: {
if (cursor != null && cursor.moveToFirst()) {
long contactId = cursor.getLong(EMAIL_ID_COLUMN_INDEX);
String lookupKey = cursor.getString(EMAIL_LOOKUP_STRING_COLUMN_INDEX);
lookupUri = Contacts.getLookupUri(contactId, lookupKey);
}
break;
}
}
} finally {
if (cursor != null) {
cursor.close();
}
}
contactUri = lookupUri;
onContactUriChanged();
if (trigger && lookupUri != null) {
// Found contact, so trigger QuickContact
QuickContact.showQuickContact(
getContext(), ContactBadge.this, lookupUri, QuickContact.MODE_LARGE, null);
} else if (createUri != null) {
// Prompt user to add this person to contacts
final Intent intent = new Intent(Intents.SHOW_OR_CREATE_CONTACT, createUri);
extras.remove(EXTRA_URI_CONTENT);
intent.putExtras(extras);
getContext().startActivity(intent);
}
}