@Override public void loadFromContact(ContactEntry entry) { super.loadFromContact(entry); mPhoneNumberString = null; // ... in case we're reusing the view if (entry != null) { // Grab the phone-number to call directly... see {@link onClick()} mPhoneNumberString = entry.phoneNumber; } }
@Override protected void onFinishInflate() { super.onFinishInflate(); mName = (TextView) findViewById(R.id.contact_tile_name); mQuickContact = (QuickContactBadge) findViewById(R.id.contact_tile_quick); mPhoto = (ImageView) findViewById(R.id.contact_tile_image); mStatus = (TextView) findViewById(R.id.contact_tile_status); mPhoneLabel = (TextView) findViewById(R.id.contact_tile_phone_type); mPhoneNumber = (TextView) findViewById(R.id.contact_tile_phone_number); mPushState = findViewById(R.id.contact_tile_push_state); mHorizontalDivider = findViewById(R.id.contact_tile_horizontal_divider); OnClickListener listener = createClickListener(); setOnClickListener(listener); }
mName.setText(getNameForView(entry)); mLookupUri = entry.lookupUri; setVisibility(View.VISIBLE); DefaultImageRequest request = getDefaultImageRequest(entry.namePrimary, entry.lookupKey); configureViewForImage(entry.photoUri == null); if (mPhoto != null) { mPhotoManager.loadPhoto(mPhoto, entry.photoUri, getApproximateImageSize(), isDarkTheme(), isContactPhotoCircular(), request); mQuickContact.assignContactUri(mLookupUri); mPhotoManager.loadPhoto(mQuickContact, entry.photoUri, getApproximateImageSize(), isDarkTheme(), isContactPhotoCircular(), request); setVisibility(View.INVISIBLE);
mWhitespaceStartEnd, 0); contactTile.setLayoutParams(params); contactTile.setPhotoManager(mPhotoManager); contactTile.setListener(mListener); addView(contactTile); } else { contactTile = (ContactTileView) getChildAt(childIndex); contactTile.loadFromContact(entry); contactTile.setPaddingRelative( (mPaddingInPixels + 1) / 2, 0, mPaddingInPixels break; case ViewTypes.FREQUENT: contactTile.setHorizontalDividerVisibility( isLastRow ? View.GONE : View.VISIBLE); break;
/** * Implemented by subclasses to allow them to return a {@link DefaultImageRequest} with the * various image parameters defined to match their own layouts. * * @param displayName The display name of the contact * @param lookupKey The lookup key of the contact * @return A {@link DefaultImageRequest} object with each field configured by the subclass * as desired, or {@code null}. */ protected DefaultImageRequest getDefaultImageRequest(String displayName, String lookupKey) { return new DefaultImageRequest(displayName, lookupKey, isContactPhotoCircular()); }
@Override public void onClick(View v) { if (mListener == null) return; mListener.onContactSelected( getLookupUri(), MoreContactUtils.getTargetRectFromView(ContactTileView.this)); } };
@Override public void loadFromContact(ContactEntry entry) { super.loadFromContact(entry); // Set phone number to null in case we're reusing the view. mPhoneNumberString = null; if (entry != null) { // Grab the phone-number to call directly. See {@link onClick()}. mPhoneNumberString = entry.phoneNumber; // If this is a blank entry, don't show anything. // TODO krelease: Just hide the view for now. For this to truly look like an empty row // the entire ContactTileRow needs to be hidden. if (entry == ContactEntry.BLANK_ENTRY) { setVisibility(View.INVISIBLE); } else { final ImageView starIcon = (ImageView) findViewById(R.id.contact_star_icon); starIcon.setVisibility(entry.isFavorite ? View.VISIBLE : View.GONE); setVisibility(View.VISIBLE); } } }