From f1e6f5a480d1ec597815a6a8ed3275c9ff63e805 Mon Sep 17 00:00:00 2001 From: Tim Su Date: Sat, 27 Dec 2008 23:19:42 +0000 Subject: [PATCH] Updated the way deadlines (absolute vs goal) are handled. Goal deadlines don't send reminders once they're overdue. Also, did some cosmetic things. --- AndroidManifest.xml | 4 +-- res/values/arrays.xml | 26 +++++++++---------- res/values/strings.xml | 5 ++-- .../astrid/activities/TaskListAdapter.java | 23 ++++++++++------ .../timsu/astrid/utilities/Notifications.java | 8 +++--- 5 files changed, 37 insertions(+), 29 deletions(-) diff --git a/AndroidManifest.xml b/AndroidManifest.xml index 28263a69d..b84984167 100644 --- a/AndroidManifest.xml +++ b/AndroidManifest.xml @@ -1,8 +1,8 @@ + android:versionCode="11" + android:versionName="1.7.5"> diff --git a/res/values/arrays.xml b/res/values/arrays.xml index 167ef3080..e81db77ae 100644 --- a/res/values/arrays.xml +++ b/res/values/arrays.xml @@ -15,22 +15,20 @@ --> - + - Hi there! Have a second? - Can I see you for a moment? + Hi there! Have a sec? + Can I see you for a sec? Have a few minutes? - I think you forgot to do something... - Excuse me? - When you have a minute... - Look what I dug up! - Are you free for a moment? - Your friendly neighborhood assistant here! - Hi! Can I bother you for a moment? - I would like a minute of your time. - It\'s a great day to get something done! + Did you forget? + Excuse me! + When you have a minute: + On your agenda: + Free for a moment? + Astrid here! + Hi! Can I bug you? + A minute of your time? + It\'s a great day to diff --git a/res/values/strings.xml b/res/values/strings.xml index 7b3714501..e551e24b1 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -67,6 +67,7 @@ Tagged \"%s\": hidden Due in + Goal Overdue by New Task Tags: @@ -162,8 +163,8 @@ - Absolute Deadline Coming Up! - Goal Deadline Coming Up! + Absolute Deadline! + Goal Deadline! diff --git a/src/com/timsu/astrid/activities/TaskListAdapter.java b/src/com/timsu/astrid/activities/TaskListAdapter.java index 0fe95b3bd..d5a19c8ff 100644 --- a/src/com/timsu/astrid/activities/TaskListAdapter.java +++ b/src/com/timsu/astrid/activities/TaskListAdapter.java @@ -38,7 +38,6 @@ import android.widget.ArrayAdapter; import android.widget.CheckBox; import android.widget.CompoundButton; import android.widget.ImageView; -import android.widget.LinearLayout; import android.widget.TextView; import android.widget.CompoundButton.OnCheckedChangeListener; @@ -109,7 +108,7 @@ public class TaskListAdapter extends ArrayAdapter { final TextView tagsView = ((TextView)view.findViewById(R.id.text_tags)); final CheckBox progress = ((CheckBox)view.findViewById(R.id.cb1)); final ImageView timer = ((ImageView)view.findViewById(R.id.image1)); - final LinearLayout properties = (LinearLayout)view.findViewById(R.id.prop_layout); + boolean hasProperties = false; view.setTag(task); progress.setTag(task); @@ -121,21 +120,29 @@ public class TaskListAdapter extends ArrayAdapter { // due date Date dueDate = task.getDefiniteDueDate(); + String dueString = ""; if(dueDate == null || (task.getPreferredDueDate() != null && - task.getPreferredDueDate().getTime() < dueDate.getTime())) + task.getPreferredDueDate().before(dueDate))) { + // only prefix with "goal:" if the real deadline isn't overdue + if(task.getDefiniteDueDate() == null || task.getDefiniteDueDate(). + after(new Date())) + dueString = r.getString(R.string.taskList_goalPrefix) + " "; dueDate = task.getPreferredDueDate(); + } if(dueDate != null) { int secondsLeft = (int)(dueDate.getTime() - System.currentTimeMillis()) / 1000; - String dueString = " " + DateUtilities.getDurationString(r, - Math.abs(secondsLeft), 1); + if(secondsLeft > 0) - dueString = r.getString(R.string.taskList_dueIn) + dueString; + dueString += r.getString(R.string.taskList_dueIn) + " "; else { - dueString = r.getString(R.string.taskList_overdueBy) + dueString; + dueString += r.getString(R.string.taskList_overdueBy) + " "; dueDateView.setTextColor(r.getColor(R.color.taskList_dueDateOverdue)); } + + dueString += DateUtilities.getDurationString(r, Math.abs(secondsLeft), 1); dueDateView.setText(dueString); + hasProperties = true; } else dueDateView.setVisibility(View.GONE); @@ -152,7 +159,7 @@ public class TaskListAdapter extends ArrayAdapter { if(tagString.length() > 0) { tagsView.setText(r.getString(R.string.tags_prefix) + " " + tagString); - } else { + } else if(!hasProperties) { tagsView.setText(r.getString(R.string.no_tags)); } diff --git a/src/com/timsu/astrid/utilities/Notifications.java b/src/com/timsu/astrid/utilities/Notifications.java index 825d1071e..e3d2b5777 100644 --- a/src/com/timsu/astrid/utilities/Notifications.java +++ b/src/com/timsu/astrid/utilities/Notifications.java @@ -137,7 +137,9 @@ public class Notifications extends BroadcastReceiver { flags = FLAG_DEFINITE_DEADLINE; } } - if(task.getPreferredDueDate() != null) { + // for goal deadlines, once it's overdue, forget about it. + if(task.getPreferredDueDate() != null && + task.getPreferredDueDate().getTime() > System.currentTimeMillis()) { long deadlineWhen = task.getPreferredDueDate().getTime() - DEADLINE_NOTIFY_SECS * 1000; if(when == null || deadlineWhen < when) { @@ -279,8 +281,8 @@ public class Notifications extends BroadcastReceiver { System.currentTimeMillis()); notification.setLatestEventInfo(context, - appName + ": " + reminder, - taskName, + appName, + reminder + " " + taskName, pendingIntent); notification.defaults = Notification.DEFAULT_ALL;