Add preference for showing task edit confirmation toasts, ab test

pull/14/head
Sam Bosley 13 years ago
parent bb6ac500f5
commit 54f9393fd4

@ -831,7 +831,8 @@ public class EditPeopleControlSet extends PopupControlSet {
}
private void showSaveToast(String saveToast) {
if(saveToast == null) return;
if(saveToast == null || !Preferences.getBoolean(R.string.p_showEditToasts, false))
return;
int length = saveToast.contains("\n") ? //$NON-NLS-1$
Toast.LENGTH_LONG : Toast.LENGTH_SHORT;
Toast.makeText(activity, saveToast, length).show();
@ -882,12 +883,6 @@ public class EditPeopleControlSet extends PopupControlSet {
values.add(message);
}
// String tag = ((TextView) getSharedWithView().findViewById(R.id.tag_name)).getText().toString();
// if(!TextUtils.isEmpty(tag)) {
// values.add("tag");
// values.add(tag);
// }
return values.toArray(new Object[values.size()]);
}

@ -70,6 +70,9 @@
<!-- account status section key -->
<string name="p_account">account</string>
<!-- show edit task confirmation toasts -->
<string name="p_showEditToasts">show_edit_toasts</string>
<string-array name="TEA_reminder_random_hours">
<!-- values (in hours) associated with items above. -->
<item>1</item>

@ -595,6 +595,9 @@
<!-- slide 34g: Preference: Task List Font Size Description -->
<string name="EPr_fontSize_desc">Font size on the main listing page</string>
<!-- Preferemce: Show task edit confirmation toasts -->
<string name="EPr_showEditToasts_title">Show task edit confirmations</string>
<!-- slide 34c: Preference: Task List Show Notes -->
<string name="EPr_showNotes_title">Show Notes In Task</string>
<!-- slide 30e: Preference: Beast mode (auto-expand edit page) -->

@ -90,6 +90,11 @@
android:key="@string/p_show_featured_lists_labs"
android:defaultValue="false"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_showEditToasts"
android:title="@string/EPr_showEditToasts_title"
android:defaultValue="false" />
<CheckBoxPreference
android:key="@string/p_use_contact_picker"
android:title="@string/EPr_use_contact_picker"/>

@ -971,8 +971,9 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
* Show toast for task edit canceling
*/
private void showCancelToast() {
Toast.makeText(getActivity(), R.string.TEA_onTaskCancel,
Toast.LENGTH_SHORT).show();
if (Preferences.getBoolean(R.string.p_showEditToasts, false))
Toast.makeText(getActivity(), R.string.TEA_onTaskCancel,
Toast.LENGTH_SHORT).show();
}
protected void deleteButtonClick() {
@ -1005,8 +1006,9 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener {
* Show toast for task edit deleting
*/
private void showDeleteToast() {
Toast.makeText(getActivity(), R.string.TEA_onTaskDelete,
Toast.LENGTH_SHORT).show();
if (Preferences.getBoolean(R.string.p_showEditToasts, false))
Toast.makeText(getActivity(), R.string.TEA_onTaskDelete,
Toast.LENGTH_SHORT).show();
}
private void startAttachFile() {

@ -119,7 +119,10 @@ public class ABTests {
bundles.put(testKey, bundle);
}
public static final String AB_TASK_EDIT_TOAST = "android_task_edit_toast"; //$NON-NLS-1$
private void initialize() {
//
addTest(AB_TASK_EDIT_TOAST, new int[] { 1, 1 },
new int[] { 1, 1 }, new String[] { "dont-show-toasts", "show-toasts" }); //$NON-NLS-1$ //$NON-NLS-2$
}
}

@ -23,6 +23,8 @@ import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.data.User;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABTests;
public class AstridPreferences {
@ -70,6 +72,9 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_ideas_tab_enabled, true);
Preferences.setIfUnset(prefs, editor, r, R.string.p_showEditToasts,
ABChooser.readChoiceForTest(ABTests.AB_TASK_EDIT_TOAST) != 0);
if ("white-blue".equals(Preferences.getStringValue(R.string.p_theme))) { //$NON-NLS-1$ migrate from when white-blue wasn't the default
Preferences.setString(R.string.p_theme, ThemeService.THEME_WHITE);
}

Loading…
Cancel
Save