AB test the friends view, added descriptions for all the astrid labs features

pull/14/head
Sam Bosley 13 years ago
parent f23c0cdb22
commit 2b75a4de1e

@ -18,18 +18,22 @@ public class LabsPreferences extends TodorooPreferenceActivity {
public static final int PERFORMANCE_SETTING_CHANGED = 3;
@Override
public void updatePreferences(Preference preference, Object value) {
final Resources r = getResources();
if (r.getString(R.string.p_swipe_lists_performance_key).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new OnPreferenceChangeListener() {
private final OnPreferenceChangeListener settingChangedListener = new OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference p, Object newValue) {
setResult(PERFORMANCE_SETTING_CHANGED);
updatePreferences(p, newValue);
return true;
}
});
};
@Override
public void updatePreferences(Preference preference, Object value) {
final Resources r = getResources();
String key = preference.getKey();
if (r.getString(R.string.p_swipe_lists_performance_key).equals(key)) {
preference.setOnPreferenceChangeListener(settingChangedListener);
int index = 0;
if(value instanceof String && !TextUtils.isEmpty((String)value))
@ -40,6 +44,25 @@ public class LabsPreferences extends TodorooPreferenceActivity {
String name = r.getStringArray(R.array.EPr_swipe_lists_performance_mode)[index];
String desc = r.getStringArray(R.array.EPr_swipe_lists_performance_desc)[index];
preference.setSummary(r.getString(R.string.EPr_swipe_lists_display, name, desc));
} else if (r.getString(R.string.p_show_friends_view).equals(key)) {
preference.setOnPreferenceChangeListener(settingChangedListener);
if (value != null && (Boolean) value) {
preference.setSummary(R.string.EPr_show_friends_view_desc_enabled);
} else {
preference.setSummary(R.string.EPr_show_friends_view_desc_disabled);
}
} else if (r.getString(R.string.p_field_missed_calls).equals(key)) {
if (value != null && (Boolean) value) {
preference.setSummary(R.string.MCA_missed_calls_pref_desc_enabled);
} else {
preference.setSummary(R.string.MCA_missed_calls_pref_desc_disabled);
}
} else if (r.getString(R.string.p_use_contact_picker).equals(key)) {
if (value != null && (Boolean) value) {
preference.setSummary(R.string.EPr_use_contact_picker_desc_enabled);
} else {
preference.setSummary(R.string.EPr_use_contact_picker_desc_disabled);
}
}
}

@ -49,6 +49,9 @@
<!-- field missed calls preference -->
<string name="p_field_missed_calls">field_missed_calls</string>
<!-- show friends view preference -->
<string name="p_show_friends_view">show_friends_view</string>
<string-array name="TEA_reminder_random_hours">
<!-- values (in hours) associated with items above. -->
<item>1</item>

@ -496,7 +496,8 @@
<string name="MCA_missed_calls_pref_title">Field missed calls</string>
<!-- Missed call: preference description -->
<string name="MCA_missed_calls_pref_desc">Astrid will notify you about missed calls and offer to remind you to call back</string>
<string name="MCA_missed_calls_pref_desc_enabled">Astrid will notify you about missed calls and offer to remind you to call back</string>
<string name="MCA_missed_calls_pref_desc_disabled">Astrid will not notify you about missed calls</string>
<!-- Missed call: task title with name (%1$s -> name, %2$s -> number)-->
<string name="MCA_task_title_name">Call %1$s back at %2$s</string>
@ -597,7 +598,7 @@
<!-- Preference screen: Astrid Labs (experimental features)-->
<string name="EPr_labs_header">Astrid Labs</string>
<string name="EPr_labs_desc">Try and configure upcoming features</string>
<string name="EPr_labs_desc">Try and configure experimental features</string>
<!-- Preference: swipe between lists performance -->
<string name="EPr_swipe_lists_performance_title">Swipe between lists</string>
@ -605,7 +606,13 @@
<!-- Preferences: use the system contact picker for task assignment -->
<string name="EPr_use_contact_picker">Use contact picker</string>
<string name="EPr_use_contact_picker_desc">Display the system contact picker option in the task assignment window</string>
<string name="EPr_use_contact_picker_desc_enabled">The system contact picker option will be displayed in the task assignment window</string>
<string name="EPr_use_contact_picker_desc_disabled">The system contact picker option will not be displayed</string>
<!-- Preferences: show the friends view -->
<string name="EPr_show_friends_view">Show Friends View</string>
<string name="EPr_show_friends_view_desc_enabled">Friends menu item will be shown</string>
<string name="EPr_show_friends_view_desc_disabled">Friends menu item will be hidden</string>
<string name="EPr_swipe_lists_restart_alert">You will need to restart Astrid for this change to take effect</string>

@ -11,10 +11,11 @@
android:summary="@string/EPr_swipe_lists_performance_subtitle" />
<CheckBoxPreference
android:key="@string/p_use_contact_picker"
android:title="@string/EPr_use_contact_picker"
android:summary="@string/EPr_use_contact_picker_desc"/>
android:title="@string/EPr_use_contact_picker"/>
<CheckBoxPreference
android:key="@string/p_field_missed_calls"
android:title="@string/MCA_missed_calls_pref_title"
android:summary="@string/MCA_missed_calls_pref_desc" />
android:title="@string/MCA_missed_calls_pref_title"/>
<CheckBoxPreference
android:key="@string/p_show_friends_view"
android:title="@string/EPr_show_friends_view"/>
</PreferenceScreen>

@ -115,7 +115,10 @@ public class ABTests {
}
private void initialize() { // Set up
//Calls to addTest go here
addTest(AB_TEST_FRIENDS_VIEW_AVAILABLE, new int[] { 1, 1 },
new int[] { 8, 2 }, new String[] { "friends-view-disabled", "friends-view-enabled" }); //$NON-NLS-1$ //$NON-NLS-2$
}
public static final String AB_TEST_FRIENDS_VIEW_AVAILABLE = "friends-view"; //$NON-NLS-1$
}

@ -16,6 +16,7 @@ import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.ui.TouchInterceptingFrameLayout.InterceptTouchListener;
@ -100,9 +101,12 @@ public class MainMenuPopover extends FragmentPopover implements InterceptTouchLi
addMenuItem(R.string.TLA_menu_lists,
ThemeService.getDrawable(R.drawable.icn_menu_lists, themeFlags),
MAIN_MENU_ITEM_LISTS, null, topFixed); // Lists item
if (Preferences.getBoolean(R.string.p_show_friends_view, false))
addMenuItem(R.string.TLA_menu_friends,
ThemeService.getDrawable(R.drawable.icn_menu_friends, themeFlags),
MAIN_MENU_ITEM_FRIENDS, null, topFixed);
addMenuItem(R.string.TLA_menu_search,
ThemeService.getDrawable(R.drawable.icn_menu_search, themeFlags),
MAIN_MENU_ITEM_SEARCH, null, topFixed);

@ -11,6 +11,8 @@ import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABTests;
public class AstridPreferences {
@ -51,6 +53,8 @@ public class AstridPreferences {
Preferences.setIfUnset(prefs, editor, r, R.string.p_use_contact_picker, true);
Preferences.setIfUnset(prefs, editor, r, R.string.p_field_missed_calls, true);
boolean friendsViewEnabled = (ABChooser.readChoiceForTest(ABTests.AB_TEST_FRIENDS_VIEW_AVAILABLE) == 1);
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