diff options
author | linyuh <linyuh@google.com> | 2018-03-19 18:31:59 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-19 19:07:16 -0700 |
commit | 64b5778049a9ab24e4aa3736facd01cfd8931f5e (patch) | |
tree | 02ddea30d4dff695cd90fae9a286c0226c95c176 /java/com/android/dialer/calllogutils | |
parent | 3e97f65b217c4b9e64c33e083b451ba83f239f6a (diff) |
Convert @AutoValue CoalescedRow to a proto
Test: Existing tests
PiperOrigin-RevId: 189675976
Change-Id: Ieae92b5ac2aefd3f0397bbb07ebb1c97bd72ed42
Diffstat (limited to 'java/com/android/dialer/calllogutils')
-rw-r--r-- | java/com/android/dialer/calllogutils/CallLogEntryText.java | 41 | ||||
-rw-r--r-- | java/com/android/dialer/calllogutils/CallLogIntents.java | 8 |
2 files changed, 25 insertions, 24 deletions
diff --git a/java/com/android/dialer/calllogutils/CallLogEntryText.java b/java/com/android/dialer/calllogutils/CallLogEntryText.java index 6f1047cb7..c77869169 100644 --- a/java/com/android/dialer/calllogutils/CallLogEntryText.java +++ b/java/com/android/dialer/calllogutils/CallLogEntryText.java @@ -43,23 +43,23 @@ public final class CallLogEntryText { public static CharSequence buildPrimaryText(Context context, CoalescedRow row) { // Always prefer the presentation name, like "Restricted". Optional<String> presentationName = - PhoneNumberDisplayUtil.getNameForPresentation(context, row.numberPresentation()); + PhoneNumberDisplayUtil.getNameForPresentation(context, row.getNumberPresentation()); if (presentationName.isPresent()) { return presentationName.get(); } - if (row.isVoicemailCall() && !TextUtils.isEmpty(row.voicemailCallTag())) { - return row.voicemailCallTag(); + if (row.getIsVoicemailCall() && !TextUtils.isEmpty(row.getVoicemailCallTag())) { + return row.getVoicemailCallTag(); } // Otherwise prefer the name. - if (!TextUtils.isEmpty(row.numberAttributes().getName())) { - return row.numberAttributes().getName(); + if (!TextUtils.isEmpty(row.getNumberAttributes().getName())) { + return row.getNumberAttributes().getName(); } // Otherwise prefer the formatted number. - if (!TextUtils.isEmpty(row.formattedNumber())) { - return row.formattedNumber(); + if (!TextUtils.isEmpty(row.getFormattedNumber())) { + return row.getFormattedNumber(); } // If there's no formatted number, just return "Unknown". @@ -99,17 +99,18 @@ public final class CallLogEntryText { Context context, Clock clock, CoalescedRow row) { List<CharSequence> components = new ArrayList<>(); - if (row.numberAttributes().getIsBlocked()) { + if (row.getNumberAttributes().getIsBlocked()) { components.add(context.getText(R.string.new_call_log_secondary_blocked)); } - if (row.numberAttributes().getIsSpam()) { + if (row.getNumberAttributes().getIsSpam()) { components.add(context.getText(R.string.new_call_log_secondary_spam)); } components.add(getNumberTypeLabel(context, row)); components.add( - CallLogDates.newCallLogTimestampLabel(context, clock.currentTimeMillis(), row.timestamp())); + CallLogDates.newCallLogTimestampLabel( + context, clock.currentTimeMillis(), row.getTimestamp())); return joinSecondaryTextComponents(components); } @@ -147,10 +148,10 @@ public final class CallLogEntryText { */ List<CharSequence> components = new ArrayList<>(); - if (row.numberAttributes().getIsBlocked()) { + if (row.getNumberAttributes().getIsBlocked()) { components.add(context.getText(R.string.new_call_log_secondary_blocked)); } - if (row.numberAttributes().getIsSpam()) { + if (row.getNumberAttributes().getIsSpam()) { components.add(context.getText(R.string.new_call_log_secondary_spam)); } @@ -159,20 +160,20 @@ public final class CallLogEntryText { // If there's a presentation name, we showed it in the primary text and shouldn't show any name // or number here. Optional<String> presentationName = - PhoneNumberDisplayUtil.getNameForPresentation(context, row.numberPresentation()); + PhoneNumberDisplayUtil.getNameForPresentation(context, row.getNumberPresentation()); if (presentationName.isPresent()) { return joinSecondaryTextComponents(components); } - if (TextUtils.isEmpty(row.numberAttributes().getName())) { + if (TextUtils.isEmpty(row.getNumberAttributes().getName())) { // If the name is empty the number is shown as the primary text and there's nothing to add. return joinSecondaryTextComponents(components); } - if (TextUtils.isEmpty(row.formattedNumber())) { + if (TextUtils.isEmpty(row.getFormattedNumber())) { // If there's no number, don't append anything. return joinSecondaryTextComponents(components); } - components.add(row.formattedNumber()); + components.add(row.getFormattedNumber()); return joinSecondaryTextComponents(components); } @@ -186,19 +187,19 @@ public final class CallLogEntryText { */ private static CharSequence getNumberTypeLabel(Context context, CoalescedRow row) { StringBuilder secondaryText = new StringBuilder(); - if ((row.features() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) { + if ((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO) { // TODO(zachh): Add "Duo" prefix? secondaryText.append(context.getText(R.string.new_call_log_video)); } - String numberTypeLabel = row.numberAttributes().getNumberTypeLabel(); + String numberTypeLabel = row.getNumberAttributes().getNumberTypeLabel(); if (!TextUtils.isEmpty(numberTypeLabel)) { if (secondaryText.length() > 0) { secondaryText.append(", "); } secondaryText.append(numberTypeLabel); - } else if (!row.numberAttributes().getIsSpam()) { + } else if (!row.getNumberAttributes().getIsSpam()) { // Don't show the location if there's a number type label or the number is spam. - String location = row.geocodedLocation(); + String location = row.getGeocodedLocation(); if (!TextUtils.isEmpty(location)) { if (secondaryText.length() > 0) { secondaryText.append(", "); diff --git a/java/com/android/dialer/calllogutils/CallLogIntents.java b/java/com/android/dialer/calllogutils/CallLogIntents.java index 64fb33d13..18927f77d 100644 --- a/java/com/android/dialer/calllogutils/CallLogIntents.java +++ b/java/com/android/dialer/calllogutils/CallLogIntents.java @@ -39,8 +39,8 @@ public final class CallLogIntents { */ @Nullable public static Intent getCallBackIntent(Context context, CoalescedRow row) { - String normalizedNumber = row.number().getNormalizedNumber(); - if (!PhoneNumberHelper.canPlaceCallsTo(normalizedNumber, row.numberPresentation())) { + String normalizedNumber = row.getNumber().getNormalizedNumber(); + if (!PhoneNumberHelper.canPlaceCallsTo(normalizedNumber, row.getNumberPresentation())) { return null; } @@ -50,7 +50,7 @@ public final class CallLogIntents { new CallIntentBuilder(normalizedNumber, CallInitiationType.Type.CALL_LOG) .setPhoneAccountHandle( TelecomUtil.composePhoneAccountHandle( - row.phoneAccountComponentName(), row.phoneAccountId())) - .setIsVideoCall((row.features() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO)); + row.getPhoneAccountComponentName(), row.getPhoneAccountId())) + .setIsVideoCall((row.getFeatures() & Calls.FEATURES_VIDEO) == Calls.FEATURES_VIDEO)); } } |