Much feedback prompt logic and placeholder layouts

pull/14/head
Sam Bosley 11 years ago
parent 40dc1fcc79
commit e6a1115339

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="43dip"
android:gravity="center_vertical"
android:background="@android:color/darker_gray"
android:orientation="horizontal" >
<TextView
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:layout_marginLeft="10dip"
android:gravity="center_vertical"
style="@style/TextAppearance"
android:textStyle="bold"
android:textColor="#333333"
android:layout_weight="1"
android:text="How is Astrid doing?"/>
<TextView
android:id="@+id/positiveFeedback"
android:layout_width="25dip"
android:layout_height="25dip"
android:gravity="center"
android:layout_marginRight="10dip"
android:background="#ff0000"
android:text="+"/>
<TextView
android:id="@+id/negativeFeedback"
android:layout_width="25dip"
android:layout_height="25dip"
android:gravity="center"
android:layout_marginRight="10dip"
android:background="#00ff00"
android:text="-"/>
<ImageView
android:id="@+id/dismiss"
android:layout_width="25dip"
android:layout_height="25dip"
android:layout_marginRight="10dip"
android:scaleType="fitCenter"
android:src="@drawable/ic_menu_close"/>
</LinearLayout>

@ -981,7 +981,7 @@ Astrid is open-source and proudly maintained by Todoroo, Inc.</string>
<string name="feedback_negative_title">Rate Astrid?</string>
<string name="feedback_negative_body">Glad I\'m helpful! Got a moment to help us with a 5-star rating?</string>
<string name="feedback_negative_body">Sorry to hear that we\'re having issues</string>
<string name="feedback_activity_error">Oops! We weren\'t able to launch the market feedback section--it might not be available on your device.</string>

@ -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() {

@ -327,12 +327,12 @@ public class TaskService {
if (Preferences.getBoolean(PREF_USER_ACTVATED, false))
return true;
TodorooCursor<Task> all = query(Query.select(Task.ID));
TodorooCursor<Task> all = query(Query.select(Task.ID).limit(TOTAL_TASKS_FOR_ACTIVATION));
try {
if (all.getCount() < TOTAL_TASKS_FOR_ACTIVATION)
return false;
TodorooCursor<Task> completed = query(Query.select(Task.ID).where(TaskCriteria.completed()));
TodorooCursor<Task> completed = query(Query.select(Task.ID).where(TaskCriteria.completed()).limit(COMPLETED_TASKS_FOR_ACTIVATION));
try {
if (completed.getCount() < COMPLETED_TASKS_FOR_ACTIVATION)
return false;

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

Loading…
Cancel
Save