diff options
author | Eric Erfanian <erfanian@google.com> | 2017-05-03 23:18:35 +0000 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2017-05-03 23:18:35 +0000 |
commit | 2034759538273aed8a0b412d8fb90994eba1f7ea (patch) | |
tree | 1a45d60921e293c6088efeaf4d9c408456f3e0e2 /java/com/android/dialer/calllogutils/CallEntryFormatter.java | |
parent | 86baedee44a4902097310c689ee3ae7f0cdb1c8d (diff) | |
parent | d67f1627521b174f12e0c247f154c7c93c5e408e (diff) |
This change reflects the Dialer V10 RC00 branch. am: 8369df095a
am: d67f162752
Change-Id: I94f923a6a8af0a580723017002922e299bd335f3
Diffstat (limited to 'java/com/android/dialer/calllogutils/CallEntryFormatter.java')
-rw-r--r-- | java/com/android/dialer/calllogutils/CallEntryFormatter.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/java/com/android/dialer/calllogutils/CallEntryFormatter.java b/java/com/android/dialer/calllogutils/CallEntryFormatter.java index bd6d53f48..bd184bb89 100644 --- a/java/com/android/dialer/calllogutils/CallEntryFormatter.java +++ b/java/com/android/dialer/calllogutils/CallEntryFormatter.java @@ -76,7 +76,7 @@ public class CallEntryFormatter { UCharacter.TITLECASE_NO_LOWERCASE); } - private static CharSequence formatDuration(Context context, long elapsedSeconds) { + private static CharSequence formatDuration(Context context, long elapsedSeconds, boolean a11y) { long minutes = 0; long seconds = 0; @@ -84,10 +84,16 @@ public class CallEntryFormatter { minutes = elapsedSeconds / 60; elapsedSeconds -= minutes * 60; seconds = elapsedSeconds; - return context.getString(R.string.call_details_duration_format, minutes, seconds); + int stringId = + a11y ? R.string.call_details_duration_format_a11y : R.string.call_details_duration_format; + return context.getString(stringId, minutes, seconds); } else { seconds = elapsedSeconds; - return context.getString(R.string.call_details_short_duration_format, seconds); + int stringId = + a11y + ? R.string.call_details_short_duration_format_a11y + : R.string.call_details_short_duration_format; + return context.getString(stringId, seconds); } } @@ -96,13 +102,14 @@ public class CallEntryFormatter { * * @param elapsedSeconds Total elapsed seconds. * @param dataUsage Data usage in bytes, or null if not specified. + * @param a11y {@code true} if string should be talk back friendly. * @return String containing call duration and data usage. */ public static CharSequence formatDurationAndDataUsage( - Context context, long elapsedSeconds, Long dataUsage) { - CharSequence duration = formatDuration(context, elapsedSeconds); + Context context, long elapsedSeconds, long dataUsage, boolean a11y) { + CharSequence duration = formatDuration(context, elapsedSeconds, a11y); List<CharSequence> durationItems = new ArrayList<>(); - if (dataUsage != null) { + if (dataUsage > 0) { durationItems.add(duration); durationItems.add(Formatter.formatShortFileSize(context, dataUsage)); return DialerUtils.join(durationItems); |