From 3a44f18827dd8adacf7776162140f4969c9f2807 Mon Sep 17 00:00:00 2001 From: linyuh Date: Thu, 24 May 2018 10:56:02 -0700 Subject: Better a11y for contact badge in the new call log. Bug: 70989658 Test: GlidePhotoManagerImplTest PiperOrigin-RevId: 197918533 Change-Id: I61d04e270ddf4237e8ed9c10e62e8d95f86d1eca --- java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java | 2 +- java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java | 2 +- java/com/android/dialer/calllog/ui/menu/Modules.java | 2 +- java/com/android/dialer/calllogutils/PhotoInfoBuilder.java | 4 +++- 4 files changed, 6 insertions(+), 4 deletions(-) diff --git a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java index 3b21a60de..cdc0858da 100644 --- a/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java +++ b/java/com/android/dialer/calllog/ui/NewCallLogViewHolder.java @@ -189,7 +189,7 @@ final class NewCallLogViewHolder extends RecyclerView.ViewHolder { } private void setPhoto(CoalescedRow row) { - contactPhotoView.setPhoto(PhotoInfoBuilder.fromCoalescedRow(row).build()); + contactPhotoView.setPhoto(PhotoInfoBuilder.fromCoalescedRow(activity, row).build()); } private void setFeatureIcons(CoalescedRow row) { diff --git a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java index 25ae47691..6d0b7951f 100644 --- a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java +++ b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java @@ -28,7 +28,7 @@ final class BottomSheetHeader { static HistoryItemBottomSheetHeaderInfo fromRow(Context context, CoalescedRow row) { return HistoryItemBottomSheetHeaderInfo.newBuilder() .setNumber(row.getNumber()) - .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(row)) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(context, row)) .setPrimaryText(CallLogEntryText.buildPrimaryText(context, row).toString()) .setSecondaryText( CallLogEntryText.buildSecondaryTextForBottomSheet(context, row).toString()) diff --git a/java/com/android/dialer/calllog/ui/menu/Modules.java b/java/com/android/dialer/calllog/ui/menu/Modules.java index ded495807..7c6c65ca9 100644 --- a/java/com/android/dialer/calllog/ui/menu/Modules.java +++ b/java/com/android/dialer/calllog/ui/menu/Modules.java @@ -88,7 +88,7 @@ final class Modules { Context context, CoalescedRow row) { return CallDetailsHeaderInfo.newBuilder() .setDialerPhoneNumber(row.getNumber()) - .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(row)) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(context, row)) .setPrimaryText(CallLogEntryText.buildPrimaryText(context, row).toString()) .setSecondaryText( CallLogEntryText.buildSecondaryTextForBottomSheet(context, row).toString()) diff --git a/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java b/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java index 0677c9114..2e2e4abcb 100644 --- a/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java +++ b/java/com/android/dialer/calllogutils/PhotoInfoBuilder.java @@ -16,6 +16,7 @@ package com.android.dialer.calllogutils; +import android.content.Context; import android.provider.CallLog.Calls; import android.support.v4.os.BuildCompat; import com.android.dialer.NumberAttributes; @@ -28,8 +29,9 @@ import com.android.dialer.voicemail.model.VoicemailEntry; public final class PhotoInfoBuilder { /** Returns a {@link PhotoInfo.Builder} with info from {@link CoalescedRow}. */ - public static PhotoInfo.Builder fromCoalescedRow(CoalescedRow coalescedRow) { + public static PhotoInfo.Builder fromCoalescedRow(Context context, CoalescedRow coalescedRow) { return fromNumberAttributes(coalescedRow.getNumberAttributes()) + .setName(CallLogEntryText.buildPrimaryText(context, coalescedRow).toString()) .setFormattedNumber(coalescedRow.getFormattedNumber()) .setIsVoicemail(coalescedRow.getIsVoicemailCall()) .setIsSpam( -- cgit v1.2.3