diff --git a/astrid/res/layout/feedback_prompt.xml b/astrid/res/layout/feedback_prompt.xml
new file mode 100644
index 000000000..13eb5b6c8
--- /dev/null
+++ b/astrid/res/layout/feedback_prompt.xml
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml
index e0c36f4ae..e5ea0ee17 100644
--- a/astrid/res/values/strings-core.xml
+++ b/astrid/res/values/strings-core.xml
@@ -981,7 +981,7 @@ Astrid is open-source and proudly maintained by Todoroo, Inc.
Rate Astrid?
- Glad I\'m helpful! Got a moment to help us with a 5-star rating?
+ Sorry to hear that we\'re having issues
Oops! We weren\'t able to launch the market feedback section--it might not be available on your device.
diff --git a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java
index 726ea20fa..7ca10aee1 100644
--- a/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java
+++ b/astrid/src/com/todoroo/astrid/activity/TaskListFragment.java
@@ -44,6 +44,7 @@ import android.widget.AbsListView.OnScrollListener;
import android.widget.AdapterView;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.AdapterView.OnItemClickListener;
+import android.widget.FrameLayout;
import android.widget.ListView;
import android.widget.TextView;
@@ -62,6 +63,7 @@ import com.todoroo.andlib.sql.Criterion;
import com.todoroo.andlib.sql.Field;
import com.todoroo.andlib.sql.Join;
import com.todoroo.andlib.utility.AndroidUtilities;
+import com.todoroo.andlib.utility.DateUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.actfm.ActFmLoginActivity;
import com.todoroo.astrid.actfm.CommentsActivity;
@@ -107,6 +109,7 @@ import com.todoroo.astrid.subtasks.SubtasksUpdater;
import com.todoroo.astrid.sync.SyncProviderPreferences;
import com.todoroo.astrid.tags.TaskToTagMetadata;
import com.todoroo.astrid.timers.TimerPlugin;
+import com.todoroo.astrid.ui.FeedbackPromptDialogs;
import com.todoroo.astrid.ui.QuickAddBar;
import com.todoroo.astrid.utility.AstridPreferences;
import com.todoroo.astrid.utility.Flags;
@@ -126,6 +129,9 @@ public class TaskListFragment extends SherlockListFragment implements OnScrollLi
public static final String TAG_TASKLIST_FRAGMENT = "tasklist_fragment"; //$NON-NLS-1$
+ private static final String PREF_LAST_FEEDBACK_TIME = "pref_last_feedback_time"; //$NON-NLS-1$
+ private static final long FEEDBACK_TIME_INTERVAL = DateUtilities.ONE_WEEK * 12;
+
// --- activities
public static final long AUTOSYNC_INTERVAL = 90000L;
@@ -705,6 +711,56 @@ public class TaskListFragment extends SherlockListFragment implements OnScrollLi
refreshFilterCount();
initiateAutomaticSync();
+
+ showFeedbackPrompt();
+ }
+
+ private void showFeedbackPrompt() {
+ if (!(this instanceof TagViewFragment) &&
+ (DateUtilities.now() - Preferences.getLong(PREF_LAST_FEEDBACK_TIME, 0)) > FEEDBACK_TIME_INTERVAL &&
+ taskService.getUserActivationStatus()) {
+ final FrameLayout root = (FrameLayout) getView();
+ final View feedbackPrompt = getActivity().getLayoutInflater().inflate(R.layout.feedback_prompt, root, false);
+
+ feedbackPrompt.findViewById(R.id.dismiss).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ try {
+ root.removeView(feedbackPrompt);
+ } catch (Exception e) {
+ //
+ }
+ }
+ });
+
+ feedbackPrompt.findViewById(R.id.positiveFeedback).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ try {
+ root.removeView(feedbackPrompt);
+ FeedbackPromptDialogs.showFeedbackDialog((AstridActivity) getActivity(), true);
+// Preferences.setLong(PREF_LAST_FEEDBACK_TIME, DateUtilities.now());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ feedbackPrompt.findViewById(R.id.negativeFeedback).setOnClickListener(new OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ try {
+ root.removeView(feedbackPrompt);
+ FeedbackPromptDialogs.showFeedbackDialog((AstridActivity) getActivity(), false);
+// Preferences.setLong(PREF_LAST_FEEDBACK_TIME, DateUtilities.now());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ });
+
+ root.addView(feedbackPrompt);
+ }
}
protected boolean isCurrentTaskListFragment() {
diff --git a/astrid/src/com/todoroo/astrid/service/TaskService.java b/astrid/src/com/todoroo/astrid/service/TaskService.java
index 5a7849819..5a8fcc08b 100644
--- a/astrid/src/com/todoroo/astrid/service/TaskService.java
+++ b/astrid/src/com/todoroo/astrid/service/TaskService.java
@@ -327,12 +327,12 @@ public class TaskService {
if (Preferences.getBoolean(PREF_USER_ACTVATED, false))
return true;
- TodorooCursor all = query(Query.select(Task.ID));
+ TodorooCursor all = query(Query.select(Task.ID).limit(TOTAL_TASKS_FOR_ACTIVATION));
try {
if (all.getCount() < TOTAL_TASKS_FOR_ACTIVATION)
return false;
- TodorooCursor completed = query(Query.select(Task.ID).where(TaskCriteria.completed()));
+ TodorooCursor completed = query(Query.select(Task.ID).where(TaskCriteria.completed()).limit(COMPLETED_TASKS_FOR_ACTIVATION));
try {
if (completed.getCount() < COMPLETED_TASKS_FOR_ACTIVATION)
return false;
diff --git a/astrid/src/com/todoroo/astrid/ui/AstridDialog.java b/astrid/src/com/todoroo/astrid/ui/AstridDialog.java
index 64ee37463..319716a51 100644
--- a/astrid/src/com/todoroo/astrid/ui/AstridDialog.java
+++ b/astrid/src/com/todoroo/astrid/ui/AstridDialog.java
@@ -20,7 +20,7 @@ public class AstridDialog extends Dialog {
super(activity, R.style.ReminderDialog);
setContentView(forcePortrait ? R.layout.astrid_dialog_view_portrait : R.layout.astrid_dialog_view);
- buttons = new Button[2];
+ buttons = new Button[3];
buttons[0] = (Button) findViewById(R.id.button0);
buttons[1] = (Button) findViewById(R.id.button1);
buttons[2] = (Button) findViewById(R.id.button2);