Slight change to notification logic. Tweaked a lot of the colors.

pull/14/head
Tim Su 17 years ago
parent a9264f0a2b
commit c44321ac1a

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" <manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid" package="com.timsu.astrid"
android:versionCode="17" android:versionCode="20"
android:versionName="1.7.8"> android:versionName="1.7.10">
<uses-permission android:name="android.permission.VIBRATE"/> <uses-permission android:name="android.permission.VIBRATE"/>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 176 B

After

Width:  |  Height:  |  Size: 179 B

@ -21,11 +21,11 @@
--> -->
<resources> <resources>
<color name="task_list_overdue">#F09EA6</color> <color name="task_list_overdue">#F09EA6</color>
<color name="task_list_done">#ffaaaaaa</color> <color name="task_list_done">#ff777777</color>
<color name="taskList_dueDateOverdue">#ffFFBF9E</color> <color name="taskList_dueDateOverdue">#ffFFBF9E</color>
<color name="taskList_dueDate">#ffF0E89E</color> <color name="taskList_dueDate">#ffF0E89E</color>
<color name="taskList_completedDate">#ffccffaa</color> <color name="taskList_completedDate">#ff888888</color>
<color name="taskList_tags">#ff888888</color> <color name="taskList_tags">#ff888888</color>
<color name="view_header_done">#ff83ffa9</color> <color name="view_header_done">#ff83ffa9</color>

@ -37,6 +37,10 @@
<item quantity="one">1 Task</item> <item quantity="one">1 Task</item>
<item quantity="other">%d Tasks</item> <item quantity="other">%d Tasks</item>
</plurals> </plurals>
<plurals name="NactiveTasks">
<item quantity="one">%d / %d Active</item>
<item quantity="other">%d / %d Active</item>
</plurals>
<plurals name="Ntags"> <plurals name="Ntags">
<item quantity="one">1 Tag</item> <item quantity="one">1 Tag</item>
<item quantity="other">%d Tags</item> <item quantity="other">%d Tags</item>

@ -194,7 +194,6 @@ public class TaskList extends Activity {
if(filterTag != null) { if(filterTag != null) {
List<TaskIdentifier> tasks = tagController.getTaggedTasks(this, List<TaskIdentifier> tasks = tagController.getTaggedTasks(this,
filterTag.getTagIdentifier()); filterTag.getTagIdentifier());
tasksCursor = controller.getTaskListCursorById(tasks); tasksCursor = controller.getTaskListCursorById(tasks);
} else { } else {
if(filterShowDone) if(filterShowDone)
@ -202,15 +201,22 @@ public class TaskList extends Activity {
else else
tasksCursor = controller.getActiveTaskListCursor(); tasksCursor = controller.getActiveTaskListCursor();
} }
startManagingCursor(tasksCursor); startManagingCursor(tasksCursor);
taskArray = controller.createTaskListFromCursor(tasksCursor, taskArray = controller.createTaskListFromCursor(tasksCursor,
!filterShowHidden); !filterShowHidden);
int hiddenTasks = tasksCursor.getCount() - taskArray.size(); int hiddenTasks = tasksCursor.getCount() - taskArray.size();
int doneTasks = 0;
for(TaskModelForList task : taskArray)
if(task.isTaskCompleted())
doneTasks++;
int activeTasks = taskArray.size() - doneTasks;
// hide "add" button if we have a few tasks // hide "add" button if we have a few tasks
if(taskArray.size() > 2) if(taskArray.size() > 2)
addButton.setVisibility(View.GONE); addButton.setVisibility(View.GONE);
else
addButton.setVisibility(View.VISIBLE);
// set up the title // set up the title
StringBuilder title = new StringBuilder(). StringBuilder title = new StringBuilder().
@ -219,6 +225,11 @@ public class TaskList extends Activity {
title.append(r.getString(R.string.taskList_titleTagPrefix, title.append(r.getString(R.string.taskList_titleTagPrefix,
filterTag.getName())).append(" "); filterTag.getName())).append(" ");
} }
if(doneTasks > 0)
title.append(r.getQuantityString(R.plurals.NactiveTasks,
activeTasks, activeTasks, taskArray.size()));
else
title.append(r.getQuantityString(R.plurals.Ntasks, title.append(r.getQuantityString(R.plurals.Ntasks,
taskArray.size(), taskArray.size())); taskArray.size(), taskArray.size()));
if(hiddenTasks > 0) if(hiddenTasks > 0)

@ -160,6 +160,9 @@ public class TaskController extends AbstractController {
long id = task.getTaskIdentifier().getId(); long id = task.getTaskIdentifier().getId();
ContentValues values = task.getSetValues(); ContentValues values = task.getSetValues();
if(values.size() == 0) // nothing changed
return true;
// set completion date // set completion date
if(values.containsKey(AbstractTaskModel.PROGRESS_PERCENTAGE) && if(values.containsKey(AbstractTaskModel.PROGRESS_PERCENTAGE) &&
values.getAsInteger(AbstractTaskModel.PROGRESS_PERCENTAGE) values.getAsInteger(AbstractTaskModel.PROGRESS_PERCENTAGE)
@ -167,7 +170,7 @@ public class TaskController extends AbstractController {
values.put(AbstractTaskModel.COMPLETION_DATE, System.currentTimeMillis()); values.put(AbstractTaskModel.COMPLETION_DATE, System.currentTimeMillis());
} }
saveSucessful = database.update(TASK_TABLE_NAME, task.getSetValues(), saveSucessful = database.update(TASK_TABLE_NAME, values,
KEY_ROWID + "=" + id, null) > 0; KEY_ROWID + "=" + id, null) > 0;
} }

@ -29,8 +29,8 @@ public class Notifications extends BroadcastReceiver {
// stuff for scheduling // stuff for scheduling
private static final int MIN_INTERVAL_SECONDS = 300; private static final int MIN_INTERVAL_SECONDS = 300;
private static final float FUDGE_MIN = 0.2f; private static final float FUDGE_MIN = 0.4f;
private static final float FUDGE_MAX = 0.8f; private static final float FUDGE_MAX = 1.1f;
/** # of seconds before a deadline to notify */ /** # of seconds before a deadline to notify */
private static final int DEADLINE_NOTIFY_SECS = 3600; private static final int DEADLINE_NOTIFY_SECS = 3600;
/** # of seconds after now, if a deadline is in the past */ /** # of seconds after now, if a deadline is in the past */
@ -127,8 +127,9 @@ public class Notifications extends BroadcastReceiver {
// compute, and add a fudge factor to mix things up a bit // compute, and add a fudge factor to mix things up a bit
interval = task.getNotificationIntervalSeconds(); interval = task.getNotificationIntervalSeconds();
int currentSeconds = (int)(System.currentTimeMillis() / 1000); int currentSeconds = (int)(System.currentTimeMillis() / 1000);
int untilNextInterval = interval - currentSeconds % interval; int flexyInterval = interval * (int)(FUDGE_MIN + random.nextFloat()
untilNextInterval *= FUDGE_MIN + random.nextFloat() * (FUDGE_MAX - FUDGE_MIN); * (FUDGE_MAX - FUDGE_MIN));
int untilNextInterval = flexyInterval - currentSeconds % flexyInterval;
if(untilNextInterval < MIN_INTERVAL_SECONDS) if(untilNextInterval < MIN_INTERVAL_SECONDS)
untilNextInterval = MIN_INTERVAL_SECONDS; untilNextInterval = MIN_INTERVAL_SECONDS;
when = System.currentTimeMillis() + untilNextInterval * 1000; when = System.currentTimeMillis() + untilNextInterval * 1000;

Loading…
Cancel
Save