diff options
author | Treehugger Robot <treehugger-gerrit@google.com> | 2018-05-18 22:15:19 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-05-18 22:15:19 +0000 |
commit | b327b63680f609125b80a3804445a8cf16e70fcb (patch) | |
tree | 201cfd29ae955524c29c7bc41738fff2a7c8d59e /java/com/android/dialer/calllog/ui/menu | |
parent | 619080d929b914e218bd32aa30287a67bf10551b (diff) | |
parent | 00cdd7b552b3fde4c9cbc1c4e4d0edc1b54df365 (diff) |
Merge "Remove duplicate code when constructing PhotoInfo proto."
Diffstat (limited to 'java/com/android/dialer/calllog/ui/menu')
-rw-r--r-- | java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java | 14 | ||||
-rw-r--r-- | java/com/android/dialer/calllog/ui/menu/Modules.java | 18 |
2 files changed, 4 insertions, 28 deletions
diff --git a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java index 4e25cedf4..25ae47691 100644 --- a/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java +++ b/java/com/android/dialer/calllog/ui/menu/BottomSheetHeader.java @@ -17,11 +17,9 @@ package com.android.dialer.calllog.ui.menu; import android.content.Context; -import android.provider.CallLog.Calls; -import android.support.v4.os.BuildCompat; import com.android.dialer.calllog.model.CoalescedRow; import com.android.dialer.calllogutils.CallLogEntryText; -import com.android.dialer.calllogutils.NumberAttributesConverter; +import com.android.dialer.calllogutils.PhotoInfoBuilder; import com.android.dialer.historyitemactions.HistoryItemBottomSheetHeaderInfo; /** Configures the top row in the bottom sheet. */ @@ -30,15 +28,7 @@ final class BottomSheetHeader { static HistoryItemBottomSheetHeaderInfo fromRow(Context context, CoalescedRow row) { return HistoryItemBottomSheetHeaderInfo.newBuilder() .setNumber(row.getNumber()) - .setPhotoInfo( - NumberAttributesConverter.toPhotoInfoBuilder(row.getNumberAttributes()) - .setFormattedNumber(row.getFormattedNumber()) - .setIsVideo((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) - .setIsVoicemail(row.getIsVoicemailCall()) - .setIsRtt( - BuildCompat.isAtLeastP() - && (row.getFeatures() & Calls.FEATURES_RTT) == Calls.FEATURES_RTT) - .build()) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(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 cfeca1059..ded495807 100644 --- a/java/com/android/dialer/calllog/ui/menu/Modules.java +++ b/java/com/android/dialer/calllog/ui/menu/Modules.java @@ -17,15 +17,12 @@ package com.android.dialer.calllog.ui.menu; import android.content.Context; -import android.provider.CallLog.Calls; -import android.support.v4.os.BuildCompat; import android.text.TextUtils; import com.android.dialer.calldetails.CallDetailsActivity; import com.android.dialer.calldetails.CallDetailsHeaderInfo; import com.android.dialer.calllog.model.CoalescedRow; import com.android.dialer.calllogutils.CallLogEntryText; -import com.android.dialer.calllogutils.NumberAttributesConverter; -import com.android.dialer.glidephotomanager.PhotoInfo; +import com.android.dialer.calllogutils.PhotoInfoBuilder; import com.android.dialer.historyitemactions.HistoryItemActionModule; import com.android.dialer.historyitemactions.HistoryItemActionModuleInfo; import com.android.dialer.historyitemactions.HistoryItemActionModulesBuilder; @@ -91,24 +88,13 @@ final class Modules { Context context, CoalescedRow row) { return CallDetailsHeaderInfo.newBuilder() .setDialerPhoneNumber(row.getNumber()) - .setPhotoInfo(createPhotoInfoFromRow(row)) + .setPhotoInfo(PhotoInfoBuilder.fromCoalescedRow(row)) .setPrimaryText(CallLogEntryText.buildPrimaryText(context, row).toString()) .setSecondaryText( CallLogEntryText.buildSecondaryTextForBottomSheet(context, row).toString()) .build(); } - private static PhotoInfo createPhotoInfoFromRow(CoalescedRow row) { - return NumberAttributesConverter.toPhotoInfoBuilder(row.getNumberAttributes()) - .setFormattedNumber(row.getFormattedNumber()) - .setIsVideo((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) - .setIsRtt( - BuildCompat.isAtLeastP() - && (row.getFeatures() & Calls.FEATURES_RTT) == Calls.FEATURES_RTT) - .setIsVoicemail(row.getIsVoicemailCall()) - .build(); - } - private static boolean canSupportAssistedDialing(CoalescedRow row) { return !TextUtils.isEmpty(row.getNumberAttributes().getLookupUri()); } |