android.provider.ContactsContract.QuickContact Java Examples
The following examples show how to use
android.provider.ContactsContract.QuickContact.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: QuickContactBadge.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
@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(), QuickContactBadge.this, mContactUri, mExcludeMimes, mPrioritizedMimeType); } 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; } }
Example #2
Source File: ContactBadge.java From Android-ContactPicker with Apache License 2.0 | 6 votes |
@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; } }
Example #3
Source File: ContactBadge.java From Android-ContactPicker with Apache License 2.0 | 6 votes |
@Override public void onQueryComplete(int token, Uri uri, Bundle extras, boolean trigger, Uri createUri) { assignContactUri(uri); if (trigger && uri != null) { // Found contact, so trigger QuickContact ContactsContract.QuickContact.showQuickContact(getContext(), ContactBadge.this, uri, ContactsContract.QuickContact.MODE_LARGE, mExcludeMimes); } else if (createUri != null) { // Prompt user to add this person to contacts final Intent intent = new Intent(ContactsContract.Intents.SHOW_OR_CREATE_CONTACT, createUri); if (extras != null) { extras.remove(Constants.EXTRA_URI_CONTENT); intent.putExtras(extras); } getContext().startActivity(intent); } }