diff --git a/api/src/com/todoroo/andlib/utility/AndroidUtilities.java b/api/src/com/todoroo/andlib/utility/AndroidUtilities.java index 6b24932f0..09b2bf05d 100644 --- a/api/src/com/todoroo/andlib/utility/AndroidUtilities.java +++ b/api/src/com/todoroo/andlib/utility/AndroidUtilities.java @@ -924,6 +924,28 @@ public class AndroidUtilities { } } + /** + * Tries to parse an int from a string, returning the default value on failure + */ + public static int tryParseInt(String str, int defaultValue) { + try { + return Integer.parseInt(str); + } catch (NumberFormatException e) { + return defaultValue; + } + } + + /** + * Tries to parse an int from a string, returning the default value on failure + */ + public static long tryParseLong(String str, long defaultValue) { + try { + return Long.parseLong(str); + } catch (NumberFormatException e) { + return defaultValue; + } + } + /** * Returns the final word characters after the last '.' * @param file diff --git a/api/src/com/todoroo/andlib/utility/DateUtilities.java b/api/src/com/todoroo/andlib/utility/DateUtilities.java index cc26dc6e3..6c0b32a9b 100644 --- a/api/src/com/todoroo/andlib/utility/DateUtilities.java +++ b/api/src/com/todoroo/andlib/utility/DateUtilities.java @@ -97,11 +97,11 @@ public class DateUtilities { * @return time, with hours and minutes */ @SuppressWarnings("nls") - public static String getTimeString(Context context, Date date) { + public static String getTimeString(Context context, Date date, boolean excludeZeroMinutes) { String value; if (is24HourFormat(context)) { value = "H:mm"; - } else if (date.getMinutes() == 0){ + } else if (date.getMinutes() == 0 && excludeZeroMinutes){ value = "h a"; } else { @@ -110,6 +110,10 @@ public class DateUtilities { return new SimpleDateFormat(value).format(date); } + public static String getTimeString(Context context, Date date) { + return getTimeString(context, date, true); + } + /* Returns true if search string is in sortedValues */ private static boolean arrayBinaryContains(String search, String... sortedValues) { @@ -122,7 +126,7 @@ public class DateUtilities { * @return date, with month, day, and year */ @SuppressWarnings("nls") - public static String getDateString(Context context, Date date) { + public static String getDateString(Context context, Date date, boolean includeYear) { String month = DateUtils.getMonthString(date.getMonth() + Calendar.JANUARY, DateUtils.LENGTH_MEDIUM); String value; @@ -131,9 +135,11 @@ public class DateUtilities { Locale locale = Locale.getDefault(); if (arrayBinaryContains(locale.getLanguage(), "ja", "ko", "zh") || arrayBinaryContains(locale.getCountry(), "BZ", "CA", "KE", "MN" ,"US")) - value = "'#' d'$', yyyy"; + value = "'#' d'$'"; else - value = "d'$' '#', yyyy"; + value = "d'$' '#'"; + if (includeYear) + value += ", yyyy"; if (arrayBinaryContains(locale.getLanguage(), "ja", "zh")){ standardDate = new SimpleDateFormat(value).format(date).replace("#", month).replace("$", "\u65E5"); //$NON-NLS-1$ }else if ("ko".equals(Locale.getDefault().getLanguage())){ @@ -143,6 +149,10 @@ public class DateUtilities { } return standardDate;} + public static String getDateString(Context context, Date date) { + return getDateString(context, date, true); + } + /** * @param context android context * @param date date to format @@ -263,7 +273,7 @@ public class DateUtilities { } public static boolean isoStringHasTime(String iso8601String) { - return iso8601String.length() > 12; + return iso8601String.length() > 10; } public static long parseIso8601(String iso8601String) throws ParseException { diff --git a/astrid/res/values/strings-updates.xml b/astrid/res/values/strings-updates.xml index 9b1b66ec0..9d9552142 100644 --- a/astrid/res/values/strings-updates.xml +++ b/astrid/res/values/strings-updates.xml @@ -17,6 +17,10 @@ %1$s on %2$s: %3$s You + yourself + you + (a deleted user) + this list this task deleted %s @@ -30,6 +34,30 @@ set name to %2$s changed description from %1$s to %2$s set description to %2$s + made %s public + made %s private + silenced %s + unsilenced %s + favorited %s + unfavorited %s + change this list\'s picture + added %1$d characters to %2$s description + removed %s description + removed %1$d characters from %2$s description + updated %s description + changed list owner to %s + created this list + unassigned %s + claimed %s + assigned %1$s to %2$s + created %1$s for %2$s + created %s + changed %1$s due date from %2$s to %3$s + set %1$s due date to %2$s + removed %s due date + completed %1$s (now due on %2$s) + + changed %1$s to %2$s