diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-03 23:18:35 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-03 23:18:35 +0000 |
commit | 2034759538273aed8a0b412d8fb90994eba1f7ea (patch) | |
tree | 1a45d60921e293c6088efeaf4d9c408456f3e0e2 /java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java | |
parent | 86baedee44a4902097310c689ee3ae7f0cdb1c8d (diff) | |
parent | d67f1627521b174f12e0c247f154c7c93c5e408e (diff) |
This change reflects the Dialer V10 RC00 branch. am: 8369df095a
am: d67f162752
Change-Id: I94f923a6a8af0a580723017002922e299bd335f3
Diffstat (limited to 'java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java')
-rw-r--r-- | java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java | 36 |
1 files changed, 22 insertions, 14 deletions
diff --git a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java index 416c521a2..437c2602c 100644 --- a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java +++ b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java @@ -25,12 +25,12 @@ import android.view.View.OnClickListener; import android.widget.QuickContactBadge; import android.widget.TextView; import com.android.contacts.common.ContactPhotoManager; -import com.android.dialer.callcomposer.nano.CallComposerContact; +import com.android.dialer.callcomposer.CallComposerContact; +import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; -import com.android.dialer.callintent.nano.CallInitiationType; import com.android.dialer.common.Assert; +import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; -import com.android.dialer.logging.nano.DialerImpression; import com.android.dialer.util.DialerUtils; /** ViewHolder for Header/Contact in {@link CallDetailsActivity}. */ @@ -56,29 +56,37 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder } /** Populates the contact info fields based on the current contact information. */ - public void updateContactInfo(CallComposerContact contact) { + void updateContactInfo(CallComposerContact contact) { this.contact = contact; ContactPhotoManager.getInstance(context) - .loadDialerThumbnail( + .loadDialerThumbnailOrPhoto( contactPhoto, - contact.contactUri == null ? null : Uri.parse(contact.contactUri), - contact.photoId, - contact.nameOrNumber, - contact.contactType); + contact.hasContactUri() ? Uri.parse(contact.getContactUri()) : null, + contact.getPhotoId(), + contact.hasPhotoUri() ? Uri.parse(contact.getPhotoUri()) : null, + contact.getNameOrNumber(), + contact.getContactType()); - nameView.setText(contact.nameOrNumber); - if (!TextUtils.isEmpty(contact.numberLabel) && !TextUtils.isEmpty(contact.displayNumber)) { + contactPhoto.setContentDescription( + context.getString(R.string.description_contact_photo_details, contact.getNameOrNumber())); + nameView.setText(contact.getNameOrNumber()); + if (!TextUtils.isEmpty(contact.getNumberLabel()) + && !TextUtils.isEmpty(contact.getDisplayNumber())) { numberView.setVisibility(View.VISIBLE); String secondaryInfo = context.getString( com.android.contacts.common.R.string.call_subject_type_and_number, - contact.numberLabel, - contact.displayNumber); + contact.getNumberLabel(), + contact.getDisplayNumber()); numberView.setText(secondaryInfo); } else { numberView.setVisibility(View.GONE); numberView.setText(null); } + + if (TextUtils.isEmpty(contact.getNumber())) { + callBackButton.setVisibility(View.GONE); + } } @Override @@ -87,7 +95,7 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder Logger.get(view.getContext()).logImpression(DialerImpression.Type.CALL_DETAILS_CALL_BACK); DialerUtils.startActivityWithErrorToast( view.getContext(), - new CallIntentBuilder(contact.number, CallInitiationType.Type.CALL_DETAILS).build()); + new CallIntentBuilder(contact.getNumber(), CallInitiationType.Type.CALL_DETAILS).build()); } else { Assert.fail("View OnClickListener not implemented: " + view); } |