diff options
author | linyuh <linyuh@google.com> | 2018-03-19 19:05:03 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-19 20:11:08 -0700 |
commit | 67a08ed881afd9b3f7bee630eb58d39ffd8efae2 (patch) | |
tree | 7c562c5cf532be5860517630c62602c18f8dd4d7 /java/com/android/dialer/voicemail/listui/VoicemailEntryText.java | |
parent | 393d1df37f455ac8715c345e70a8446610ab0c4c (diff) |
Convert @AutoValue VoicemailEntry to a proto
Test: Existing tests
PiperOrigin-RevId: 189678764
Change-Id: I6b9edd99e727788c65d325c1be43f0190c25c30e
Diffstat (limited to 'java/com/android/dialer/voicemail/listui/VoicemailEntryText.java')
-rw-r--r-- | java/com/android/dialer/voicemail/listui/VoicemailEntryText.java | 22 |
1 files changed, 12 insertions, 10 deletions
diff --git a/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java b/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java index 4aaf2d1e7..973f9b1a8 100644 --- a/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java +++ b/java/com/android/dialer/voicemail/listui/VoicemailEntryText.java @@ -33,10 +33,10 @@ public class VoicemailEntryText { public static String buildPrimaryVoicemailText(Context context, VoicemailEntry data) { StringBuilder primaryText = new StringBuilder(); - if (!TextUtils.isEmpty(data.numberAttributes().getName())) { - primaryText.append(data.numberAttributes().getName()); - } else if (!TextUtils.isEmpty(data.formattedNumber())) { - primaryText.append(data.formattedNumber()); + if (!TextUtils.isEmpty(data.getNumberAttributes().getName())) { + primaryText.append(data.getNumberAttributes().getName()); + } else if (!TextUtils.isEmpty(data.getFormattedNumber())) { + primaryText.append(data.getFormattedNumber()); } else { // TODO(uabdullah): Handle CallLog.Calls.PRESENTATION_*, including Verizon restricted numbers. primaryText.append(context.getText(R.string.voicemail_entry_unknown)); @@ -71,7 +71,7 @@ public class VoicemailEntryText { private static String secondaryTextPrefix( Context context, Clock clock, VoicemailEntry voicemailEntry) { StringBuilder secondaryText = new StringBuilder(); - String location = voicemailEntry.geocodedLocation(); + String location = voicemailEntry.getGeocodedLocation(); if (!TextUtils.isEmpty(location)) { secondaryText.append(location); } @@ -80,9 +80,9 @@ public class VoicemailEntryText { } secondaryText.append( CallLogDates.newCallLogTimestampLabel( - context, clock.currentTimeMillis(), voicemailEntry.timestamp())); + context, clock.currentTimeMillis(), voicemailEntry.getTimestamp())); - long duration = voicemailEntry.duration(); + long duration = voicemailEntry.getDuration(); if (duration >= 0) { secondaryText.append(" • "); String formattedDuration = getVoicemailDuration(context, voicemailEntry); @@ -92,15 +92,17 @@ public class VoicemailEntryText { } static String getVoicemailDuration(Context context, VoicemailEntry voicemailEntry) { - long minutes = TimeUnit.SECONDS.toMinutes(voicemailEntry.duration()); - long seconds = voicemailEntry.duration() - TimeUnit.MINUTES.toSeconds(minutes); + long minutes = TimeUnit.SECONDS.toMinutes(voicemailEntry.getDuration()); + long seconds = voicemailEntry.getDuration() - TimeUnit.MINUTES.toSeconds(minutes); // The format for duration is "MM:SS" and we never expect the duration to be > 5 minutes // However an incorrect duration could be set by the framework/someone to be >99, and in that // case cap it at 99, for the UI to still be able to display it in "MM:SS" format. if (minutes > 99) { LogUtil.w( - "VoicemailEntryText.getVoicemailDuration", "Duration was %d", voicemailEntry.duration()); + "VoicemailEntryText.getVoicemailDuration", + "Duration was %d", + voicemailEntry.getDuration()); minutes = 99; } return context.getString(R.string.voicemailDurationFormat, minutes, seconds); |