private void loadContactPhoto(ContactInfo info, String displayName, QuickContactBadge badge) { final String lookupKey = info.lookupUri == null ? null : UriUtils.getLookupKeyFromUri(info.lookupUri); final int contactType = mContactInfoHelper.isBusiness(info.sourceType) ? ContactPhotoManager.TYPE_BUSINESS : ContactPhotoManager.TYPE_DEFAULT; final DefaultImageRequest request = new DefaultImageRequest(displayName, lookupKey, contactType, true /* isCircular */); badge.assignContactUri(info.lookupUri); badge.setContentDescription( mContext.getResources().getString(R.string.description_contact_details, displayName)); mContactPhotoManager.loadDirectoryPhoto(badge, info.photoUri, false /* darkTheme */, true /* isCircular */, request); }
private void updateContactPhoto() { if (mDetails == null) { return; } final boolean isVoicemailNumber = PhoneNumberUtil.isVoicemailNumber(mContext, mDetails.accountHandle, mNumber); final boolean isBusiness = mContactInfoHelper.isBusiness(mDetails.sourceType); int contactType = ContactPhotoManager.TYPE_DEFAULT; if (isVoicemailNumber) { contactType = ContactPhotoManager.TYPE_VOICEMAIL; } else if (isBusiness) { contactType = ContactPhotoManager.TYPE_BUSINESS; } final String displayName = TextUtils.isEmpty(mDetails.namePrimary) ? mDetails.displayNumber : mDetails.namePrimary.toString(); final String lookupKey = mDetails.contactUri == null ? null : UriUtils.getLookupKeyFromUri(mDetails.contactUri); final DefaultImageRequest request = new DefaultImageRequest(displayName, lookupKey, contactType, true /* isCircular */); mQuickContactBadge.assignContactUri(mDetails.contactUri); mQuickContactBadge.setContentDescription( mResources.getString(R.string.description_contact_details, displayName)); mContactPhotoManager.loadDirectoryPhoto(mQuickContactBadge, mDetails.photoUri, false /* darkTheme */, true /* isCircular */, request); }
protected void bindPhoto(final ContactListItemView view, int partitionIndex, Cursor cursor) { if (!isPhotoSupported(partitionIndex)) { view.removePhotoView(); return; } long photoId = 0; if (!cursor.isNull(PhoneQuery.PHOTO_ID)) { photoId = cursor.getLong(PhoneQuery.PHOTO_ID); } if (photoId != 0) { getPhotoLoader().loadThumbnail(view.getPhotoView(), photoId, false, getCircularPhotos(), null); } else { final String photoUriString = cursor.getString(PhoneQuery.PHOTO_URI); final Uri photoUri = photoUriString == null ? null : Uri.parse(photoUriString); DefaultImageRequest request = null; if (photoUri == null) { final String displayName = cursor.getString(PhoneQuery.DISPLAY_NAME); final String lookupKey = cursor.getString(PhoneQuery.LOOKUP_KEY); request = new DefaultImageRequest(displayName, lookupKey, getCircularPhotos()); } getPhotoLoader().loadDirectoryPhoto(view.getPhotoView(), photoUri, false, getCircularPhotos(), request); } }
protected void bindPhoto(final ContactListItemView view, int partitionIndex, Cursor cursor) { if (!isPhotoSupported(partitionIndex)) { view.removePhotoView(); return; } // Set the photo, if available long photoId = 0; if (!cursor.isNull(ContactQuery.CONTACT_PHOTO_ID)) { photoId = cursor.getLong(ContactQuery.CONTACT_PHOTO_ID); } if (photoId != 0) { getPhotoLoader().loadThumbnail(view.getPhotoView(), photoId, false, getCircularPhotos(), null); } else { final String photoUriString = cursor.getString(ContactQuery.CONTACT_PHOTO_URI); final Uri photoUri = photoUriString == null ? null : Uri.parse(photoUriString); DefaultImageRequest request = null; if (photoUri == null) { request = getDefaultImageRequestFromCursor(cursor, ContactQuery.CONTACT_DISPLAY_NAME, ContactQuery.CONTACT_LOOKUP_KEY); } getPhotoLoader().loadDirectoryPhoto(view.getPhotoView(), photoUri, false, getCircularPhotos(), request); } }