From eef33d9bf793a3bfb5394aba05b3f799cd26d28a Mon Sep 17 00:00:00 2001 From: linyuh Date: Wed, 28 Mar 2018 09:33:56 -0700 Subject: Badge contact photos in the new call log for video calls. Bug: 70988682 Test: NewCallLogViewHolderTest PiperOrigin-RevId: 190783830 Change-Id: Ib0b1ec23b7c278b83516019924b6c68ff12adaf9 --- .../drawable/quantum_ic_videocam_vd_white_24.xml | 24 ++++++++++ .../dialer/calllog/ui/NewCallLogViewHolder.java | 17 ++++++-- .../drawable/contact_photo_badge_background.xml | 23 ++++++++++ .../calllog/ui/res/layout/new_call_log_entry.xml | 51 +++++++++++++++++----- 4 files changed, 101 insertions(+), 14 deletions(-) create mode 100644 assets/quantum/res/drawable/quantum_ic_videocam_vd_white_24.xml create mode 100644 java/com/android/dialer/calllog/ui/res/drawable/contact_photo_badge_background.xml diff --git a/assets/quantum/res/drawable/quantum_ic_videocam_vd_white_24.xml b/assets/quantum/res/drawable/quantum_ic_videocam_vd_white_24.xml new file mode 100644 index 000000000..27420cadf --- /dev/null +++ b/assets/quantum/res/drawable/quantum_ic_videocam_vd_white_24.xml @@ -0,0 +1,24 @@ + + + + diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 713ca4405..aa71ec4e1 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -24,6 +24,7 @@ import android.support.annotation.DrawableRes; import android.support.v7.widget.RecyclerView; import android.text.TextUtils; import android.view.View; +import android.widget.FrameLayout; import android.widget.ImageView; import android.widget.QuickContactBadge; import android.widget.TextView; @@ -50,7 +51,8 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private final TextView primaryTextView; private final TextView callCountTextView; private final TextView secondaryTextView; - private final QuickContactBadge quickContactBadge; + private final QuickContactBadge contactPhoto; + private final FrameLayout contactBadgeContainer; private final ImageView callTypeIcon; private final ImageView hdIcon; private final ImageView wifiIcon; @@ -76,7 +78,8 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { primaryTextView = view.findViewById(R.id.primary_text); callCountTextView = view.findViewById(R.id.call_count); secondaryTextView = view.findViewById(R.id.secondary_text); - quickContactBadge = view.findViewById(R.id.quick_contact_photo); + contactPhoto = view.findViewById(R.id.quick_contact_photo); + contactBadgeContainer = view.findViewById(R.id.contact_badge_container); callTypeIcon = view.findViewById(R.id.call_type_icon); hdIcon = view.findViewById(R.id.hd_icon); wifiIcon = view.findViewById(R.id.wifi_icon); @@ -152,11 +155,19 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { private void setPhoto(CoalescedRow row) { glidePhotoManager.loadQuickContactBadge( - quickContactBadge, + contactPhoto, NumberAttributesConverter.toPhotoInfoBuilder(row.getNumberAttributes()) .setFormattedNumber(row.getFormattedNumber()) .setIsVoicemail(row.getIsVoicemailCall()) .build()); + + contactBadgeContainer.setVisibility( + shouldShowVideoCallIcon(row) ? View.VISIBLE : View.INVISIBLE); + } + + private static boolean shouldShowVideoCallIcon(CoalescedRow row) { + return (row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO + && !row.getNumberAttributes().getIsSpam(); } private void setFeatureIcons(CoalescedRow row) { diff --git a/java/com/android/dialer/calllog/ui/res/drawable/contact_photo_badge_background.xml b/java/com/android/dialer/calllog/ui/res/drawable/contact_photo_badge_background.xml new file mode 100644 index 000000000..4dcc7057e --- /dev/null +++ b/java/com/android/dialer/calllog/ui/res/drawable/contact_photo_badge_background.xml @@ -0,0 +1,23 @@ + + + + + + + \ No newline at end of file diff --git a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml index 093f866fc..22854311d 100644 --- a/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml +++ b/java/com/android/dialer/calllog/ui/res/layout/new_call_log_entry.xml @@ -21,14 +21,43 @@ android:layout_height="wrap_content" android:minHeight="72dp"> - + + + + + + + + + + + +