Move Producteev into astrid labs

pull/14/head
Sam Bosley 12 years ago
parent 1215c3d5c5
commit 57f291f809

@ -46,23 +46,25 @@ public class LabsPreferences extends TodorooPreferenceActivity {
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);
}
setEnabledSummary(preference, value,
R.string.EPr_show_friends_view_desc_enabled, 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);
}
setEnabledSummary(preference, value,
R.string.MCA_missed_calls_pref_desc_enabled, 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);
}
setEnabledSummary(preference, value,
R.string.EPr_use_contact_picker_desc_enabled, R.string.EPr_use_contact_picker_desc_disabled);
} else if (r.getString(R.string.p_third_party_addons).equals(key)) {
setEnabledSummary(preference, value,
R.string.EPr_third_party_addons_desc_enabled, R.string.EPr_third_party_addons_desc_disabled);
}
}
private void setEnabledSummary(Preference preference, Object value, int enabledStr, int disabledStr) {
if (value != null && (Boolean) value) {
preference.setSummary(enabledStr);
} else {
preference.setSummary(disabledStr);
}
}

@ -1,5 +1,7 @@
package com.todoroo.astrid.producteev;
import android.text.TextUtils;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.sync.SyncProviderUtilities;
@ -76,4 +78,9 @@ public class ProducteevUtilities extends SyncProviderUtilities {
return Preferences.getStringValue(R.string.producteev_PPr_email);
}
@Override
public boolean isLoggedIn() {
return !TextUtils.isEmpty(getLoggedInUserName());
}
}

@ -51,6 +51,9 @@
<!-- show friends view preference -->
<string name="p_show_friends_view">show_friends_view</string>
<!-- enable third party addons preference -->
<string name="p_third_party_addons">third_party_addons</string>
<string-array name="TEA_reminder_random_hours">
<!-- values (in hours) associated with items above. -->

@ -613,6 +613,11 @@
<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>
<!-- Preferences: Third party addons -->
<string name="EPr_third_party_addons">Enable Third Party Add-ons</string>
<string name="EPr_third_party_addons_desc_enabled">Third party add-ons will be enabled</string>
<string name="EPr_third_party_addons_desc_disabled">Third party add-ons will be disabled</string>
<string name="EPr_swipe_lists_restart_alert">You will need to restart Astrid for this change to take effect</string>

@ -18,4 +18,7 @@
<CheckBoxPreference
android:key="@string/p_show_friends_view"
android:title="@string/EPr_show_friends_view"/>
<CheckBoxPreference
android:key="@string/p_third_party_addons"
android:title="@string/EPr_third_party_addons" />
</PreferenceScreen>

@ -48,6 +48,7 @@ import com.todoroo.astrid.dao.Database;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.gtasks.GtasksPreferences;
import com.todoroo.astrid.helper.MetadataHelper;
import com.todoroo.astrid.producteev.ProducteevPreferences;
import com.todoroo.astrid.service.AddOnService;
import com.todoroo.astrid.service.MarketStrategy.AmazonMarketStrategy;
import com.todoroo.astrid.service.StartupService;
@ -231,6 +232,10 @@ public class EditPreferences extends TodorooPreferenceActivity {
&& AmazonMarketStrategy.isKindleFire())
continue;
if (ProducteevPreferences.class.getName().equals(resolveInfo.activityInfo.name)
&& !Preferences.getBoolean(R.string.p_third_party_addons, false))
continue;
Preference preference = new Preference(this);
preference.setTitle(resolveInfo.activityInfo.loadLabel(pm));
if (labsTitle.equals(preference.getTitle()))

@ -170,10 +170,10 @@ public class AddOnService {
LOCALE_PACKAGE, "http://www.weloveastrid.com/store",
((BitmapDrawable)r.getDrawable(R.drawable.icon_locale)).getBitmap()));
list.add(new AddOn(true, true, "Producteev", null,
"Synchronize with Producteev service. Also changes Astrid's importance levels to stars.",
Constants.PACKAGE, "http://www.producteev.com",
((BitmapDrawable)r.getDrawable(R.drawable.icon_producteev)).getBitmap()));
// list.add(new AddOn(true, true, "Producteev", null,
// "Synchronize with Producteev service. Also changes Astrid's importance levels to stars.",
// Constants.PACKAGE, "http://www.producteev.com",
// ((BitmapDrawable)r.getDrawable(R.drawable.icon_producteev)).getBitmap()));
return list.toArray(new AddOn[list.size()]);
}

@ -117,8 +117,12 @@ public class ABTests {
private void initialize() { // Set up
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$
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$
}
public static final String AB_TEST_FRIENDS_VIEW_AVAILABLE = "friends-view"; //$NON-NLS-1$
public static final String AB_TEST_PRODUCTEEV_ENABLED = "producteev"; //$NON-NLS-1$
}

@ -10,6 +10,7 @@ import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.data.Task;
import com.todoroo.astrid.producteev.ProducteevUtilities;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.service.abtesting.ABChooser;
import com.todoroo.astrid.service.abtesting.ABTests;
@ -56,6 +57,9 @@ public class AstridPreferences {
boolean friendsViewEnabled = (ABChooser.readChoiceForTest(ABTests.AB_TEST_FRIENDS_VIEW_AVAILABLE) == 1);
Preferences.setIfUnset(prefs, editor, r, R.string.p_show_friends_view, friendsViewEnabled);
boolean thirdPartyAddons = (ABChooser.readChoiceForTest(ABTests.AB_TEST_PRODUCTEEV_ENABLED) == 1) || ProducteevUtilities.INSTANCE.isLoggedIn();
Preferences.setIfUnset(prefs, editor, r, R.string.p_third_party_addons, thirdPartyAddons);
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