From 5658f820de6f5f3ed2ee33752835ff6ae7c6dacd Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Tue, 31 Jan 2012 17:59:56 -0800 Subject: [PATCH] Alert popup for when magic has happened via quickadd markup --- .../todoroo/andlib/utility/DateUtilities.java | 15 +- astrid/res/layout/astrid_reminder_view.xml | 39 +----- astrid/res/layout/astrid_speech_bubble.xml | 41 ++++++ astrid/res/values/strings-core.xml | 18 +++ .../astrid/activity/TaskEditFragment.java | 1 - .../astrid/activity/TaskListFragment.java | 18 ++- .../todoroo/astrid/service/TaskService.java | 10 +- .../astrid/ui/QuickAddMarkupDialog.java | 132 ++++++++++++++++++ .../todoroo/astrid/utility/TitleParser.java | 34 +++-- 9 files changed, 249 insertions(+), 59 deletions(-) create mode 100644 astrid/res/layout/astrid_speech_bubble.xml create mode 100644 astrid/src/com/todoroo/astrid/ui/QuickAddMarkupDialog.java diff --git a/api/src/com/todoroo/andlib/utility/DateUtilities.java b/api/src/com/todoroo/andlib/utility/DateUtilities.java index cf97ba3eb..fad5043c5 100644 --- a/api/src/com/todoroo/andlib/utility/DateUtilities.java +++ b/api/src/com/todoroo/andlib/utility/DateUtilities.java @@ -195,7 +195,7 @@ public class DateUtilities { /** * @return yesterday, today, tomorrow, or null */ - public static String getRelativeDay(Context context, long date) { + public static String getRelativeDay(Context context, long date, boolean abbreviated) { long today = clearTime(new Date()); long input = clearTime(new Date(date)); @@ -203,18 +203,25 @@ public class DateUtilities { return context.getString(R.string.today).toLowerCase(); if(today + ONE_DAY == input) - return context.getString(R.string.tmrw).toLowerCase(); + return context.getString(abbreviated ? R.string.tmrw : R.string.tomorrow).toLowerCase(); if(today == input + ONE_DAY) - return context.getString(R.string.yest).toLowerCase(); + return context.getString(abbreviated ? R.string.yest : R.string.yesterday).toLowerCase(); if(today + DateUtilities.ONE_WEEK >= input && today - DateUtilities.ONE_WEEK <= input) - return DateUtilities.getWeekdayShort(new Date(date)); + return abbreviated ? DateUtilities.getWeekdayShort(new Date(date)) : DateUtilities.getWeekday(new Date(date)); return DateUtilities.getDateStringHideYear(context, new Date(date)); } + /** + * Calls getRelativeDay with abbreviated parameter defaulted to true + */ + public static String getRelativeDay(Context context, long date) { + return DateUtilities.getRelativeDay(context, date, true); + } + private static long clearTime(Date date) { date.setTime(date.getTime() / 1000L * 1000); date.setHours(0); diff --git a/astrid/res/layout/astrid_reminder_view.xml b/astrid/res/layout/astrid_reminder_view.xml index 10dc43038..24150e121 100644 --- a/astrid/res/layout/astrid_reminder_view.xml +++ b/astrid/res/layout/astrid_reminder_view.xml @@ -32,44 +32,7 @@ - - - - - - - - +