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

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

@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.timsu.astrid"
android:versionCode="17"
android:versionName="1.7.8">
android:versionCode="20"
android:versionName="1.7.10">
<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>
<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_dueDate">#ffF0E89E</color>
<color name="taskList_completedDate">#ffccffaa</color>
<color name="taskList_completedDate">#ff888888</color>
<color name="taskList_tags">#ff888888</color>
<color name="view_header_done">#ff83ffa9</color>

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

@ -194,7 +194,6 @@ public class TaskList extends Activity {
if(filterTag != null) {
List<TaskIdentifier> tasks = tagController.getTaggedTasks(this,
filterTag.getTagIdentifier());
tasksCursor = controller.getTaskListCursorById(tasks);
} else {
if(filterShowDone)
@ -202,15 +201,22 @@ public class TaskList extends Activity {
else
tasksCursor = controller.getActiveTaskListCursor();
}
startManagingCursor(tasksCursor);
taskArray = controller.createTaskListFromCursor(tasksCursor,
!filterShowHidden);
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
if(taskArray.size() > 2)
addButton.setVisibility(View.GONE);
else
addButton.setVisibility(View.VISIBLE);
// set up the title
StringBuilder title = new StringBuilder().
@ -219,8 +225,13 @@ public class TaskList extends Activity {
title.append(r.getString(R.string.taskList_titleTagPrefix,
filterTag.getName())).append(" ");
}
title.append(r.getQuantityString(R.plurals.Ntasks,
taskArray.size(), taskArray.size()));
if(doneTasks > 0)
title.append(r.getQuantityString(R.plurals.NactiveTasks,
activeTasks, activeTasks, taskArray.size()));
else
title.append(r.getQuantityString(R.plurals.Ntasks,
taskArray.size(), taskArray.size()));
if(hiddenTasks > 0)
title.append(" (+").append(hiddenTasks).append(" ").
append(r.getString(R.string.taskList_hiddenSuffix)).append(")");

@ -160,6 +160,9 @@ public class TaskController extends AbstractController {
long id = task.getTaskIdentifier().getId();
ContentValues values = task.getSetValues();
if(values.size() == 0) // nothing changed
return true;
// set completion date
if(values.containsKey(AbstractTaskModel.PROGRESS_PERCENTAGE) &&
values.getAsInteger(AbstractTaskModel.PROGRESS_PERCENTAGE)
@ -167,7 +170,7 @@ public class TaskController extends AbstractController {
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;
}

@ -29,8 +29,8 @@ public class Notifications extends BroadcastReceiver {
// stuff for scheduling
private static final int MIN_INTERVAL_SECONDS = 300;
private static final float FUDGE_MIN = 0.2f;
private static final float FUDGE_MAX = 0.8f;
private static final float FUDGE_MIN = 0.4f;
private static final float FUDGE_MAX = 1.1f;
/** # of seconds before a deadline to notify */
private static final int DEADLINE_NOTIFY_SECS = 3600;
/** # 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
interval = task.getNotificationIntervalSeconds();
int currentSeconds = (int)(System.currentTimeMillis() / 1000);
int untilNextInterval = interval - currentSeconds % interval;
untilNextInterval *= FUDGE_MIN + random.nextFloat() * (FUDGE_MAX - FUDGE_MIN);
int flexyInterval = interval * (int)(FUDGE_MIN + random.nextFloat()
* (FUDGE_MAX - FUDGE_MIN));
int untilNextInterval = flexyInterval - currentSeconds % flexyInterval;
if(untilNextInterval < MIN_INTERVAL_SECONDS)
untilNextInterval = MIN_INTERVAL_SECONDS;
when = System.currentTimeMillis() + untilNextInterval * 1000;

Loading…
Cancel
Save