Fixed up bugs from previous update. Also, when you complete a repeating task, periodic reminders are pushed back.

pull/14/head
Tim Su 17 years ago
parent 1ac92aa1a0
commit 959741120b

@ -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="86"
android:versionName="2.3.5">
android:versionCode="87"
android:versionName="2.4.0">
<meta-data android:name="com.a0soft.gphone.aTrackDog.webURL"
android:value="http://www.weloveastrid.com" />
@ -12,6 +12,7 @@
<uses-permission android:name="android.permission.VIBRATE"/>
<uses-permission android:name="android.permission.INTERNET"/>
<uses-permission android:name="android.permission.WRITE_CALENDAR" />
<uses-permission android:name="android.permission.READ_CALENDAR" />
<application android:icon="@drawable/icon" android:label="@string/app_name">

@ -138,6 +138,12 @@ public class TaskList extends Activity {
Synchronizer.synchronize(this, true, null);
}
}
// if we have no filter tag, we're not on the last task
if(getCurrentSubActivity() == taskListWTag &&
((TaskListSubActivity)taskListWTag).getFilterTag() == null) {
switchToActivity(ActivityCode.TASK_LIST, null);
}
}
/** Set up user interface components */
@ -166,7 +172,7 @@ public class TaskList extends Activity {
};
}
/** Gesture detector switches between subactivities */
/** Gesture detector switches between sub-activities */
private class AstridGestureDetector extends SimpleOnGestureListener {
@Override
public boolean onFling(MotionEvent e1, MotionEvent e2, float velocityX, float velocityY) {

@ -858,4 +858,12 @@ public class TaskListSubActivity extends SubActivity {
return false;
}
/* ======================================================================
*===================================================== getters / setters
* ====================================================================== */
public TagModelForView getFilterTag() {
return filterTag;
}
}

@ -268,8 +268,9 @@ public class TaskController extends AbstractController {
}
// due date was updated, update calendar event
if(values.containsKey(AbstractTaskModel.DEFINITE_DUE_DATE) ||
values.containsKey(AbstractTaskModel.PREFERRED_DUE_DATE)) {
if((values.containsKey(AbstractTaskModel.DEFINITE_DUE_DATE) ||
values.containsKey(AbstractTaskModel.PREFERRED_DUE_DATE)) &&
!values.containsKey(AbstractTaskModel.CALENDAR_URI)) {
try {
Cursor cursor = fetchTaskCursor(task.getTaskIdentifier(),
new String[] { AbstractTaskModel.CALENDAR_URI });

@ -49,8 +49,18 @@ public class TaskModelForRepeat extends AbstractTaskModel implements Notifiable
NOTIFICATION_FLAGS,
};
/**
* This method updates the task to reflect a new repeat iteration. It moves
* back the due dates and updates other task properties accordingly.
*
* @param context
* @param taskController
* @param repeatInfo
*/
public void repeatTaskBy(Context context, TaskController taskController,
RepeatInfo repeatInfo) {
// move dates back
if(getDefiniteDueDate() != null)
setDefiniteDueDate(repeatInfo.shiftDate(getDefiniteDueDate()));
if(getHiddenUntil() != null)
@ -76,6 +86,10 @@ public class TaskModelForRepeat extends AbstractTaskModel implements Notifiable
alertController.addAlert(getTaskIdentifier(), newAlert);
alerts.set(i, newAlert);
}
// reset periodic alerts
setLastNotificationTime(null);
Notifications.updateAlarm(context, taskController, alertController, this);
alertController.close();
}

@ -163,16 +163,18 @@ public class Notifications extends BroadcastReceiver {
when, FLAG_PERIODIC, interval);
}
// before, during, and after deadlines
// notifications at deadlines
int estimatedDuration = DEADLINE_NOTIFY_SECS;
if(task.getEstimatedSeconds() != null && task.getEstimatedSeconds() > DEADLINE_NOTIFY_SECS)
estimatedDuration = (int)(task.getEstimatedSeconds() * 1.5f);
// we need to clear all alarms in case users removed a deadline
clearAlarm(context, task.getTaskIdentifier().getId(), FLAG_DEFINITE_DEADLINE);
clearAlarm(context, task.getTaskIdentifier().getId(), FLAG_PREFERRED_DEADLINE);
clearAlarm(context, task.getTaskIdentifier().getId(), FLAG_DEFINITE_DEADLINE | FLAG_OVERDUE);
clearAlarm(context, task.getTaskIdentifier().getId(), FLAG_PREFERRED_DEADLINE | FLAG_OVERDUE);
// before, during, and after deadlines
if((task.getNotificationFlags() & TaskModelForList.NOTIFY_BEFORE_DEADLINE) > 0) {
scheduleDeadline(context, task.getDefiniteDueDate(), -estimatedDuration,
0, FLAG_DEFINITE_DEADLINE, task);

Loading…
Cancel
Save