diff --git a/app/src/main/java/com/todoroo/andlib/utility/DateUtilities.java b/app/src/main/java/com/todoroo/andlib/utility/DateUtilities.java index f61c4ae4c..e245d3c57 100644 --- a/app/src/main/java/com/todoroo/andlib/utility/DateUtilities.java +++ b/app/src/main/java/com/todoroo/andlib/utility/DateUtilities.java @@ -90,7 +90,12 @@ public class DateUtilities { public static String getRelativeDateTime( Context context, long date, java.util.Locale locale, FormatStyle style) { - String day = getRelativeDay(context, date, locale, isAbbreviated(style)); + return getRelativeDateTime(context, date, locale, style, false); + } + + public static String getRelativeDateTime( + Context context, long date, java.util.Locale locale, FormatStyle style, boolean lowercase) { + String day = getRelativeDay(context, date, locale, isAbbreviated(style), lowercase); if (!isNullOrEmpty(day)) { if (Task.hasDueTime(date)) { String time = getTimeString(context, newDateTime(date)); @@ -113,7 +118,16 @@ public class DateUtilities { long date, java.util.Locale locale, FormatStyle style) { - String relativeDay = getRelativeDay(context, date, locale, isAbbreviated(style)); + return getRelativeDay(context, date, locale, style, false); + } + + public static String getRelativeDay( + Context context, + long date, + java.util.Locale locale, + FormatStyle style, + boolean lowercase) { + String relativeDay = getRelativeDay(context, date, locale, isAbbreviated(style), lowercase); return isNullOrEmpty(relativeDay) ? getFullDate(newDateTime(date), locale, style) : relativeDay; @@ -139,20 +153,26 @@ public class DateUtilities { return date.replaceAll("(?: de |, |/| )?" + year + "(?:年|년 | г\\.)?", ""); } - private static @Nullable String getRelativeDay(Context context, long date, java.util.Locale locale, boolean abbreviated) { + private static @Nullable String getRelativeDay(Context context, long date, java.util.Locale locale, boolean abbreviated, boolean lowercase) { DateTime startOfToday = newDateTime().startOfDay(); DateTime startOfDate = newDateTime(date).startOfDay(); if (startOfToday.equals(startOfDate)) { - return context.getString(R.string.today); + return context.getString(lowercase ? R.string.today_lowercase : R.string.today); } if (startOfToday.plusDays(1).equals(startOfDate)) { - return context.getString(abbreviated ? R.string.tmrw : R.string.tomorrow); + return context.getString( + abbreviated + ? R.string.tmrw + : lowercase ? R.string.tomorrow_lowercase : R.string.tomorrow); } if (startOfDate.plusDays(1).equals(startOfToday)) { - return context.getString(abbreviated ? R.string.yest : R.string.yesterday); + return context.getString( + abbreviated + ? R.string.yest + : lowercase ? R.string.yesterday_lowercase : R.string.yesterday); } if (Math.abs(startOfToday.getMillis() - startOfDate.getMillis()) <= DateUtilities.ONE_DAY * 6) { diff --git a/app/src/main/java/org/tasks/receivers/RepeatConfirmationReceiver.java b/app/src/main/java/org/tasks/receivers/RepeatConfirmationReceiver.java index 744c8c7bb..bd186b111 100644 --- a/app/src/main/java/org/tasks/receivers/RepeatConfirmationReceiver.java +++ b/app/src/main/java/org/tasks/receivers/RepeatConfirmationReceiver.java @@ -67,7 +67,7 @@ public class RepeatConfirmationReceiver extends BroadcastReceiver { final long newDueDate) { String dueDateString = DateUtilities.getRelativeDateTime( - activity, newDueDate, locale.getLocale(), FormatStyle.LONG); + activity, newDueDate, locale.getLocale(), FormatStyle.LONG, true); taskListFragment .makeSnackbar(R.string.repeat_snackbar, task.getTitle(), dueDateString) .setAction( diff --git a/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java b/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java index 475dd666c..a992f8a44 100644 --- a/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java +++ b/app/src/main/java/org/tasks/repeats/CustomRecurrenceDialog.java @@ -519,7 +519,7 @@ public class CustomRecurrenceDialog extends InjectingDialogFragment { getString( R.string.repeat_until, DateUtilities.getRelativeDateTime( - context, repeatUntil, locale.getLocale(), FormatStyle.MEDIUM))); + context, repeatUntil, locale.getLocale(), FormatStyle.MEDIUM, true))); repeatTimes.setVisibility(View.GONE); repeatTimesText.setVisibility(View.GONE); } else if (count > 0) { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index aa3e75456..75a787997 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -294,9 +294,12 @@ File %1$s contained %2$s.\n\n %d tasks Today + today Tomorrow + tomorrow Next %s Yesterday + yesterday Tmrw Yest Background sync