From 861d8cd2dc75f80e5a6480145bbe29a1f5156acf Mon Sep 17 00:00:00 2001 From: linyuh Date: Mon, 22 Jan 2018 14:39:15 -0800 Subject: For call log entry labels, remove the dot after abbreviated time units. The platform utility adds a dot after time units (e.g., "8 min. ago") but we prefer not to have it (e.g., "8 min ago"). Bug: 70989595 Test: CallLogDatesTest, CallLogEntryTextTest PiperOrigin-RevId: 182838540 Change-Id: Ib8766a892aa04decb38917a6c5660804755725e0 --- java/com/android/dialer/calllogutils/CallLogDates.java | 14 +++++++++++--- java/com/android/dialer/calllogutils/CallLogEntryText.java | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) (limited to 'java/com/android/dialer/calllogutils') diff --git a/java/com/android/dialer/calllogutils/CallLogDates.java b/java/com/android/dialer/calllogutils/CallLogDates.java index bdf621518..fe3c0c3ad 100644 --- a/java/com/android/dialer/calllogutils/CallLogDates.java +++ b/java/com/android/dialer/calllogutils/CallLogDates.java @@ -36,7 +36,7 @@ public final class CallLogDates { * *
    *   if < 1 minute ago: "Just now";
-   *   else if < 1 hour ago: time relative to now (e.g., "8 min. ago");
+   *   else if < 1 hour ago: time relative to now (e.g., "8 min ago");
    *   else if today: time (e.g., "12:15 PM");
    *   else if < 7 days: abbreviated day of week (e.g., "Wed");
    *   else if < 1 year: date with abbreviated month, day, but no year (e.g., "Jan 15");
@@ -50,10 +50,18 @@ public final class CallLogDates {
       return context.getString(R.string.just_now);
     }
 
-    // For calls logged less than 1 hour ago, display time relative to now (e.g., "8 min. ago").
+    // For calls logged less than 1 hour ago, display time relative to now (e.g., "8 min ago").
     if (nowMillis - timestampMillis < TimeUnit.HOURS.toMillis(1)) {
       return DateUtils.getRelativeTimeSpanString(
-          timestampMillis, nowMillis, DateUtils.MINUTE_IN_MILLIS, DateUtils.FORMAT_ABBREV_RELATIVE);
+              timestampMillis,
+              nowMillis,
+              DateUtils.MINUTE_IN_MILLIS,
+              DateUtils.FORMAT_ABBREV_RELATIVE)
+          .toString()
+          // The platform method DateUtils#getRelativeTimeSpanString adds a dot ('.') after the
+          // abbreviated time unit for some languages (e.g., "8 min. ago") but we prefer not to have
+          // the dot.
+          .replace(".", "");
     }
 
     int dayDifference = getDayDifference(nowMillis, timestampMillis);
diff --git a/java/com/android/dialer/calllogutils/CallLogEntryText.java b/java/com/android/dialer/calllogutils/CallLogEntryText.java
index 25fe86452..a7a6bba9a 100644
--- a/java/com/android/dialer/calllogutils/CallLogEntryText.java
+++ b/java/com/android/dialer/calllogutils/CallLogEntryText.java
@@ -58,7 +58,7 @@ public final class CallLogEntryText {
    *
    *