|
|
@ -1,5 +1,7 @@
|
|
|
|
package com.todoroo.astrid.reminders;
|
|
|
|
package com.todoroo.astrid.reminders;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
|
|
|
|
import android.app.AlarmManager;
|
|
|
|
import android.app.AlarmManager;
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
import android.app.PendingIntent;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
@ -13,6 +15,8 @@ public final class ReengagementService {
|
|
|
|
|
|
|
|
|
|
|
|
private static final int REQUEST_CODE = 10;
|
|
|
|
private static final int REQUEST_CODE = 10;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int DAYS_INTERVAL = 2;
|
|
|
|
|
|
|
|
|
|
|
|
public static final String PREF_REENGAGEMENT_COUNT = "pref_reengagement_count"; //$NON-NLS-1$
|
|
|
|
public static final String PREF_REENGAGEMENT_COUNT = "pref_reengagement_count"; //$NON-NLS-1$
|
|
|
|
|
|
|
|
|
|
|
|
public static final String BROADCAST_SHOW_REENGAGEMENT = Constants.PACKAGE + ".SHOW_REENGAGEMENT"; //$NON-NLS-1$
|
|
|
|
public static final String BROADCAST_SHOW_REENGAGEMENT = Constants.PACKAGE + ".SHOW_REENGAGEMENT"; //$NON-NLS-1$
|
|
|
@ -31,11 +35,16 @@ public final class ReengagementService {
|
|
|
|
int reengagementReminders = Preferences.getInt(PREF_REENGAGEMENT_COUNT, 1);
|
|
|
|
int reengagementReminders = Preferences.getInt(PREF_REENGAGEMENT_COUNT, 1);
|
|
|
|
int days;
|
|
|
|
int days;
|
|
|
|
if (reengagementReminders >= 4)
|
|
|
|
if (reengagementReminders >= 4)
|
|
|
|
days = 8;
|
|
|
|
days = DAYS_INTERVAL * 4;
|
|
|
|
else
|
|
|
|
else
|
|
|
|
days = 2 * reengagementReminders;
|
|
|
|
days = DAYS_INTERVAL * reengagementReminders;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Date date = new Date(DateUtilities.now() + DateUtilities.ONE_DAY * days / 1000L * 1000L);
|
|
|
|
|
|
|
|
date.setHours(18);
|
|
|
|
|
|
|
|
date.setMinutes(0);
|
|
|
|
|
|
|
|
date.setSeconds(0);
|
|
|
|
|
|
|
|
|
|
|
|
return DateUtilities.now() + DateUtilities.ONE_DAY * days;
|
|
|
|
return date.getTime();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|