Loading res/values-de/strings.xml +0 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,8 @@ <!-- date & time string --> <string name="today">Heute</string> <string name="today_with_time">Heute, %1$s</string> <string name="today_with_full_date">%1$s (Heute)</string> <string name="tomorrow">Morgen</string> <string name="tomorrow_with_time">Morgen, %1$s</string> <string name="tomorrow_with_full_date">%1$s (Morgen)</string> <!-- Task detail view --> <string name="activity_task_details_edit">Bearbeiten</string> Loading res/values/strings.xml +0 −2 Original line number Diff line number Diff line Loading @@ -34,10 +34,8 @@ <!-- date & time string --> <string name="today">Today</string> <string name="today_with_time">Today, %1$s</string> <string name="today_with_full_date">%1$s (Today)</string> <string name="tomorrow">Tomorrow</string> <string name="tomorrow_with_time">Tomorrow, %1$s</string> <string name="tomorrow_with_full_date">%1$s (Tomorrow)</string> <!-- Task detail view --> <string name="activity_task_details_edit">Edit</string> Loading src/org/dmfs/tasks/utils/DateFormatter.java +48 −4 Original line number Diff line number Diff line Loading @@ -47,6 +47,18 @@ public class DateFormatter public enum DateFormatContext { /** * Always uses a relative date. Use this when the date is with the past or next 6 days, otherwise you might get an absolute date. */ RELATIVE { @Override public boolean useRelative(Time now, Time date) { return Math.abs(date.toMillis(false) - now.toMillis(false)) < 7 * 24 * 3600 * 1000; } }, /** * The date format in the details view. */ Loading @@ -54,7 +66,7 @@ public class DateFormatter @Override public int getTodayStringId(Time date) { return R.string.today_with_full_date; return 0; } Loading @@ -62,7 +74,7 @@ public class DateFormatter @Override public int getTomorrowStringId(Time date) { return R.string.tomorrow_with_full_date; return 0; } Loading @@ -86,14 +98,26 @@ public class DateFormatter * * Currently this inherits the default short format. */ LIST_VIEW, LIST_VIEW { @Override public boolean useRelative(Time now, Time date) { return Math.abs(date.toMillis(false) - now.toMillis(false)) < 7 * 24 * 3600 * 1000; } }, /** * The date format in the widget. * * Currently this inherits the default short format. */ WIDGET_VIEW, WIDGET_VIEW { @Override public boolean useRelative(Time now, Time date) { return Math.abs(date.toMillis(false) - now.toMillis(false)) < 7 * 24 * 3600 * 1000; } }, /** * The date format in the dash clock. This shows a time only. Loading Loading @@ -189,6 +213,12 @@ public class DateFormatter | DateUtils.FORMAT_ABBREV_WEEKDAY; } } public boolean useRelative(Time now, Time date) { return false; } } /** Loading Loading @@ -235,6 +265,20 @@ public class DateFormatter boolean isToday = date.year == mNow.year && date.yearDay == mNow.yearDay; if (dateContext.useRelative(mNow, date)) { if (date.allDay) { Time allDayNow = new Time("UTC"); allDayNow.set(mNow.monthDay, mNow.month, mNow.year); return DateUtils.getRelativeTimeSpanString(date.toMillis(false), allDayNow.toMillis(false), DateUtils.DAY_IN_MILLIS).toString(); } else { return DateUtils.getRelativeTimeSpanString(date.toMillis(false), mNow.toMillis(false), DateUtils.MINUTE_IN_MILLIS).toString(); } } if (isToday) { int stringId = dateContext.getTodayStringId(date); Loading Loading
res/values-de/strings.xml +0 −2 Original line number Diff line number Diff line Loading @@ -32,10 +32,8 @@ <!-- date & time string --> <string name="today">Heute</string> <string name="today_with_time">Heute, %1$s</string> <string name="today_with_full_date">%1$s (Heute)</string> <string name="tomorrow">Morgen</string> <string name="tomorrow_with_time">Morgen, %1$s</string> <string name="tomorrow_with_full_date">%1$s (Morgen)</string> <!-- Task detail view --> <string name="activity_task_details_edit">Bearbeiten</string> Loading
res/values/strings.xml +0 −2 Original line number Diff line number Diff line Loading @@ -34,10 +34,8 @@ <!-- date & time string --> <string name="today">Today</string> <string name="today_with_time">Today, %1$s</string> <string name="today_with_full_date">%1$s (Today)</string> <string name="tomorrow">Tomorrow</string> <string name="tomorrow_with_time">Tomorrow, %1$s</string> <string name="tomorrow_with_full_date">%1$s (Tomorrow)</string> <!-- Task detail view --> <string name="activity_task_details_edit">Edit</string> Loading
src/org/dmfs/tasks/utils/DateFormatter.java +48 −4 Original line number Diff line number Diff line Loading @@ -47,6 +47,18 @@ public class DateFormatter public enum DateFormatContext { /** * Always uses a relative date. Use this when the date is with the past or next 6 days, otherwise you might get an absolute date. */ RELATIVE { @Override public boolean useRelative(Time now, Time date) { return Math.abs(date.toMillis(false) - now.toMillis(false)) < 7 * 24 * 3600 * 1000; } }, /** * The date format in the details view. */ Loading @@ -54,7 +66,7 @@ public class DateFormatter @Override public int getTodayStringId(Time date) { return R.string.today_with_full_date; return 0; } Loading @@ -62,7 +74,7 @@ public class DateFormatter @Override public int getTomorrowStringId(Time date) { return R.string.tomorrow_with_full_date; return 0; } Loading @@ -86,14 +98,26 @@ public class DateFormatter * * Currently this inherits the default short format. */ LIST_VIEW, LIST_VIEW { @Override public boolean useRelative(Time now, Time date) { return Math.abs(date.toMillis(false) - now.toMillis(false)) < 7 * 24 * 3600 * 1000; } }, /** * The date format in the widget. * * Currently this inherits the default short format. */ WIDGET_VIEW, WIDGET_VIEW { @Override public boolean useRelative(Time now, Time date) { return Math.abs(date.toMillis(false) - now.toMillis(false)) < 7 * 24 * 3600 * 1000; } }, /** * The date format in the dash clock. This shows a time only. Loading Loading @@ -189,6 +213,12 @@ public class DateFormatter | DateUtils.FORMAT_ABBREV_WEEKDAY; } } public boolean useRelative(Time now, Time date) { return false; } } /** Loading Loading @@ -235,6 +265,20 @@ public class DateFormatter boolean isToday = date.year == mNow.year && date.yearDay == mNow.yearDay; if (dateContext.useRelative(mNow, date)) { if (date.allDay) { Time allDayNow = new Time("UTC"); allDayNow.set(mNow.monthDay, mNow.month, mNow.year); return DateUtils.getRelativeTimeSpanString(date.toMillis(false), allDayNow.toMillis(false), DateUtils.DAY_IN_MILLIS).toString(); } else { return DateUtils.getRelativeTimeSpanString(date.toMillis(false), mNow.toMillis(false), DateUtils.MINUTE_IN_MILLIS).toString(); } } if (isToday) { int stringId = dateContext.getTodayStringId(date); Loading