diff options
Diffstat (limited to 'java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java')
-rw-r--r-- | java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java | 29 |
1 files changed, 20 insertions, 9 deletions
diff --git a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java index 4d9aacf7b..3df3c3aac 100644 --- a/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java +++ b/java/com/android/dialer/calldetails/CallDetailsHeaderViewHolder.java @@ -25,11 +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.CallComposerContact; import com.android.dialer.callintent.CallInitiationType; import com.android.dialer.callintent.CallIntentBuilder; import com.android.dialer.common.Assert; +import com.android.dialer.dialercontact.DialerContact; import com.android.dialer.logging.DialerImpression; +import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; import com.android.dialer.util.DialerUtils; @@ -40,23 +41,29 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder private final View callBackButton; private final TextView nameView; private final TextView numberView; + private final TextView networkView; private final QuickContactBadge contactPhoto; private final Context context; - private CallComposerContact contact; + private DialerContact contact; CallDetailsHeaderViewHolder(View container) { super(container); context = container.getContext(); callBackButton = container.findViewById(R.id.call_back_button); - nameView = (TextView) container.findViewById(R.id.contact_name); - numberView = (TextView) container.findViewById(R.id.phone_number); - contactPhoto = (QuickContactBadge) container.findViewById(R.id.quick_contact_photo); + nameView = container.findViewById(R.id.contact_name); + numberView = container.findViewById(R.id.phone_number); + networkView = container.findViewById(R.id.network); + contactPhoto = container.findViewById(R.id.quick_contact_photo); + callBackButton.setOnClickListener(this); + Logger.get(context) + .logQuickContactOnTouch( + contactPhoto, InteractionEvent.Type.OPEN_QUICK_CONTACT_FROM_CALL_DETAILS, true); } /** Populates the contact info fields based on the current contact information. */ - void updateContactInfo(CallComposerContact contact) { + void updateContactInfo(DialerContact contact) { this.contact = contact; ContactPhotoManager.getInstance(context) .loadDialerThumbnailOrPhoto( @@ -67,8 +74,6 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder contact.getNameOrNumber(), contact.getContactType()); - contactPhoto.setContentDescription( - context.getString(R.string.description_contact_photo_details, contact.getNameOrNumber())); nameView.setText(contact.getNameOrNumber()); if (!TextUtils.isEmpty(contact.getDisplayNumber())) { numberView.setVisibility(View.VISIBLE); @@ -85,6 +90,12 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder numberView.setText(null); } + if (!TextUtils.isEmpty(contact.getSimDetails().getNetwork())) { + networkView.setVisibility(View.VISIBLE); + networkView.setText(contact.getSimDetails().getNetwork()); + networkView.setTextColor(context.getResources().getColor(contact.getSimDetails().getColor())); + } + if (TextUtils.isEmpty(contact.getNumber())) { callBackButton.setVisibility(View.GONE); } @@ -98,7 +109,7 @@ public class CallDetailsHeaderViewHolder extends RecyclerView.ViewHolder view.getContext(), new CallIntentBuilder(contact.getNumber(), CallInitiationType.Type.CALL_DETAILS).build()); } else { - Assert.fail("View OnClickListener not implemented: " + view); + throw Assert.createIllegalStateFailException("View OnClickListener not implemented: " + view); } } } |