private ContactInfo createPhoneLookupContactInfo(Cursor phoneLookupCursor, String lookupKey) { ContactInfo info = new ContactInfo(); info.lookupKey = lookupKey; info.lookupUri = Contacts.getLookupUri(phoneLookupCursor.getLong(PhoneQuery.PERSON_ID), lookupKey); info.name = phoneLookupCursor.getString(PhoneQuery.NAME); info.type = phoneLookupCursor.getInt(PhoneQuery.PHONE_TYPE); info.label = phoneLookupCursor.getString(PhoneQuery.LABEL); info.number = phoneLookupCursor.getString(PhoneQuery.MATCHED_NUMBER); info.normalizedNumber = phoneLookupCursor.getString(PhoneQuery.NORMALIZED_NUMBER); info.photoId = phoneLookupCursor.getLong(PhoneQuery.PHOTO_ID); info.photoUri = UriUtils.parseUriOrNull(phoneLookupCursor.getString(PhoneQuery.PHOTO_URI)); info.formattedNumber = null; info.userType = ContactsUtils.determineUserType(null, phoneLookupCursor.getLong(PhoneQuery.PERSON_ID)); return info; }
intent = getCustomImIntent(im, protocol);
/** * Test if the given {@link ValuesDelta} would be considered "empty" in * terms of {@link DataKind#fieldList}. */ public static boolean isEmpty(ValuesDelta values, DataKind kind) { if (Photo.CONTENT_ITEM_TYPE.equals(kind.mimeType)) { return values.isInsert() && values.getAsByteArray(Photo.PHOTO) == null; } // No defined fields mean this row is always empty if (kind.fieldList == null) return true; for (EditField field : kind.fieldList) { // If any field has values, we're not empty final String value = values.getAsString(field.column); if (ContactsUtils.isGraphic(value)) { return false; } } return true; }
private static Intent getCustomImIntent(ImDataItem im, int protocol) { String host = im.getCustomProtocol(); final String data = im.getData(); if (TextUtils.isEmpty(data)) { return null; } if (protocol != Im.PROTOCOL_CUSTOM) { // Try bringing in a well-known host for specific protocols host = ContactsUtils.lookupProviderNameFromId(protocol); } if (TextUtils.isEmpty(host)) { return null; } final String authority = host.toLowerCase(); final Uri imUri = new Uri.Builder().scheme(SCHEME_IMTO).authority( authority).appendPath(data).build(); final Intent intent = new Intent(Intent.ACTION_SENDTO, imUri); return intent; }
protected void bindWorkProfileIcon(final ContactListItemView view, int partitionId) { final Partition partition = getPartition(partitionId); if (partition instanceof DirectoryPartition) { final DirectoryPartition directoryPartition = (DirectoryPartition) partition; final long directoryId = directoryPartition.getDirectoryId(); final long userType = ContactsUtils.determineUserType(directoryId, null); view.setWorkProfileIconEnabled(userType == ContactsUtils.USER_TYPE_WORK); } }
if (ContactsUtils.isGraphic(name)) { final DataKind kind = accountType.getKindForMimetype(StructuredName.CONTENT_ITEM_TYPE); boolean supportsDisplayName = false; if (ContactsUtils.isGraphic(phoneticName)) { StructuredNameDataItem dataItem = NameConverter.parsePhoneticName(phoneticName, null); child.put(StructuredName.PHONETIC_FAMILY_NAME, dataItem.getPhoneticFamilyName());
@Override protected void bindWorkProfileIcon(final ContactListItemView view, int partition) { final DirectoryPartition directory = (DirectoryPartition) getPartition(partition); final long directoryId = directory.getDirectoryId(); final long userType = ContactsUtils.determineUserType(directoryId, null); // Work directory must not be a extended directory. An extended directory is custom // directory in the app, but not a directory provided by framework. So it can't be // USER_TYPE_WORK. view.setWorkProfileIconEnabled( !isExtendedDirectory(directoryId) && userType == ContactsUtils.USER_TYPE_WORK); }