Updated some strings, A/B test presence of notifications

pull/14/head
Sam Bosley 13 years ago
parent 27c3d3cd4a
commit 40a26ab405

@ -19,21 +19,29 @@ public class ReengagementFragment extends DisposableTaskListFragment {
Resources r = getActivity().getResources(); Resources r = getActivity().getResources();
int color = r.getColor(ThemeService.getThemeColor()); super.initializeData();
View snooze = getView().findViewById(R.id.reminder_snooze); TextView snooze = (TextView) getView().findViewById(R.id.reminder_snooze);
snooze.setBackgroundColor(color); snooze.setBackgroundColor(r.getColor(ThemeService.getThemeColor()));
TextView reminder = (TextView) getView().findViewById(R.id.reminder_message);
if (taskAdapter.getCount() == 0) {
reminder.setText(Notifications.getRandomReminder(r.getStringArray(R.array.rmd_reengage_dialog_empty_options)));
snooze.setText(R.string.rmd_reengage_add_tasks);
snooze.setOnClickListener(new OnClickListener() { snooze.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
getActivity().finish(); quickAddBar.performButtonClick();
} }
}); });
} else {
TextView reminder = (TextView) getView().findViewById(R.id.reminder_message);
reminder.setText(Notifications.getRandomReminder(r.getStringArray(R.array.rmd_reengage_dialog_options))); reminder.setText(Notifications.getRandomReminder(r.getStringArray(R.array.rmd_reengage_dialog_options)));
snooze.setOnClickListener(new OnClickListener() {
super.initializeData(); @Override
public void onClick(View v) {
getActivity().finish();
}
});
}
} }
@Override @Override

@ -18,6 +18,8 @@ import com.todoroo.astrid.activity.TaskListFragment;
import com.todoroo.astrid.api.FilterWithCustomIntent; import com.todoroo.astrid.api.FilterWithCustomIntent;
import com.todoroo.astrid.core.SortHelper; import com.todoroo.astrid.core.SortHelper;
import com.todoroo.astrid.data.TaskApiDao.TaskCriteria; import com.todoroo.astrid.data.TaskApiDao.TaskCriteria;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABTests;
import com.todoroo.astrid.utility.Constants; import com.todoroo.astrid.utility.Constants;
public class ReengagementReceiver extends BroadcastReceiver { public class ReengagementReceiver extends BroadcastReceiver {
@ -26,6 +28,8 @@ public class ReengagementReceiver extends BroadcastReceiver {
@Override @Override
public void onReceive(Context context, Intent intent) { public void onReceive(Context context, Intent intent) {
if (ABChooser.readChoiceForTest(ABTests.AB_TEST_REENGAGEMENT_ENABLED) == 0)
return;
int reengagementReminders = Preferences.getInt(ReengagementService.PREF_REENGAGEMENT_COUNT, 1); int reengagementReminders = Preferences.getInt(ReengagementService.PREF_REENGAGEMENT_COUNT, 1);
Preferences.setInt(ReengagementService.PREF_REENGAGEMENT_COUNT, reengagementReminders + 1); Preferences.setInt(ReengagementService.PREF_REENGAGEMENT_COUNT, reengagementReminders + 1);

@ -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();
} }
} }

@ -66,10 +66,15 @@
<string name="rmd_reengage_snooze">Snooze all</string> <string name="rmd_reengage_snooze">Snooze all</string>
<string name="rmd_reengage_add_tasks">Add a task</string>
<string-array name="rmd_reengage_dialog_options"> <string-array name="rmd_reengage_dialog_options">
<item>Time to shorten your to-do list!</item> <item>Time to shorten your to-do list!</item>
</string-array> </string-array>
<string-array name="rmd_reengage_dialog_empty_options">
<item>Don\'t you want to get organized?</item>
</string-array>
<!-- ============================================= reminder preferences == --> <!-- ============================================= reminder preferences == -->
<!-- Reminder Preference Screen Title --> <!-- Reminder Preference Screen Title -->

@ -115,11 +115,14 @@ public class ABTests {
} }
private void initialize() { // Set up private void initialize() { // Set up
addTest(AB_TEST_PRODUCTEEV_ENABLED, new int[] { 1, 1 }, addTest(AB_TEST_PRODUCTEEV_ENABLED, new int[] { 1, 1 },
new int[] { 1, 0 }, new String[] { "producteev-disabled", "producteev-enabled" }); //$NON-NLS-1$ //$NON-NLS-2$ new int[] { 1, 0 }, new String[] { "producteev-disabled", "producteev-enabled" }); //$NON-NLS-1$ //$NON-NLS-2$
addTest(AB_TEST_REENGAGEMENT_ENABLED, new int[] { 1, 9 },
new int[] { 1, 9 }, new String[] { "reengagement-disabled", "reengagement-enabled" }); //$NON-NLS-1$ //$NON-NLS-2$
} }
public static final String AB_TEST_PRODUCTEEV_ENABLED = "producteev"; //$NON-NLS-1$ public static final String AB_TEST_PRODUCTEEV_ENABLED = "producteev"; //$NON-NLS-1$
public static final String AB_TEST_REENGAGEMENT_ENABLED = "reengagement"; ////$NON-NLS-1$
} }

Loading…
Cancel
Save