diff --git a/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java b/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java index 85cc51af9..faccf1913 100644 --- a/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java +++ b/astrid/plugin-src/com/todoroo/astrid/core/LabsPreferences.java @@ -3,11 +3,13 @@ package com.todoroo.astrid.core; import android.content.res.Resources; import android.preference.Preference; import android.preference.Preference.OnPreferenceChangeListener; +import android.preference.PreferenceScreen; import android.text.TextUtils; import com.timsu.astrid.R; import com.todoroo.andlib.utility.AndroidUtilities; import com.todoroo.andlib.utility.TodorooPreferenceActivity; +import com.todoroo.astrid.utility.Constants; public class LabsPreferences extends TodorooPreferenceActivity { @@ -53,6 +55,11 @@ public class LabsPreferences extends TodorooPreferenceActivity { } 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); + } else if (r.getString(R.string.p_ideas_tab_enabled).equals(key)) { + if (!Constants.MARKET_STRATEGY.allowIdeasTab()) { + PreferenceScreen screen = getPreferenceScreen(); + screen.removePreference(preference); + } } } diff --git a/astrid/res/xml/preferences_labs.xml b/astrid/res/xml/preferences_labs.xml index f658eae6e..27aaff9ec 100644 --- a/astrid/res/xml/preferences_labs.xml +++ b/astrid/res/xml/preferences_labs.xml @@ -21,5 +21,5 @@ + android:summary="@string/EPr_ideas_tab_description" /> diff --git a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java index 84b6b0a7b..27d7ced8a 100755 --- a/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java +++ b/astrid/src/com/todoroo/astrid/activity/TaskEditFragment.java @@ -115,6 +115,7 @@ import com.todoroo.astrid.ui.NestableViewPager; import com.todoroo.astrid.ui.ReminderControlSet; import com.todoroo.astrid.ui.TaskEditMoreControls; import com.todoroo.astrid.ui.WebServicesView; +import com.todoroo.astrid.utility.Constants; import com.todoroo.astrid.utility.Flags; import com.todoroo.astrid.voice.VoiceInputAssistant; import com.viewpagerindicator.TabPageIndicator; @@ -390,7 +391,7 @@ ViewPager.OnPageChangeListener, EditNoteActivity.UpdatesChangedListener { boolean hasTitle = !TextUtils.isEmpty(model.getValue(Task.TITLE)); - if(hasTitle && Preferences.getBoolean(R.string.p_ideas_tab_enabled, false)) + if(hasTitle && Preferences.getBoolean(R.string.p_ideas_tab_enabled, false) && Constants.MARKET_STRATEGY.allowIdeasTab()) tabStyle = TAB_STYLE_ACTIVITY_WEB; else tabStyle = TAB_STYLE_ACTIVITY; diff --git a/astrid/src/com/todoroo/astrid/service/MarketStrategy.java b/astrid/src/com/todoroo/astrid/service/MarketStrategy.java index 4f2438d8f..2e25515d2 100644 --- a/astrid/src/com/todoroo/astrid/service/MarketStrategy.java +++ b/astrid/src/com/todoroo/astrid/service/MarketStrategy.java @@ -32,6 +32,13 @@ public abstract class MarketStrategy { return true; } + /** + * @return true if ideas tab should be shown + */ + public boolean allowIdeasTab() { + return true; + } + public static class AndroidMarketStrategy extends MarketStrategy { @Override @@ -101,6 +108,11 @@ public abstract class MarketStrategy { return false; } + @Override + public boolean allowIdeasTab() { + return false; + } + } } diff --git a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java index 800d609dc..a11a54abf 100644 --- a/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java +++ b/astrid/src/com/todoroo/astrid/service/abtesting/ABTests.java @@ -3,6 +3,8 @@ package com.todoroo.astrid.service.abtesting; import java.util.HashMap; import java.util.Set; +import com.todoroo.astrid.utility.Constants; + /** * Helper class to define options with their probabilities and descriptions * @author Sam Bosley @@ -121,8 +123,11 @@ public class ABTests { addTest(AB_TEST_REENGAGEMENT_ENABLED, new int[] { 1, 9 }, new int[] { 1, 9 }, new String[] { "reengagement-disabled", "reengagement-enabled" }); //$NON-NLS-1$ //$NON-NLS-2$ - addTest(AB_TEST_IDEAS_TAB, new int[] { 1, 1 }, - new int[] { 0, 1 }, new String[] { "ideas-tab-diabled", "ideas-tab-enabled" }); //$NON-NLS-1$ //$NON-NLS-2$ + boolean allowIdeasTab = Constants.MARKET_STRATEGY.allowIdeasTab(); + int[] noIdeasTab = new int[] { 1, 0 }; + + addTest(AB_TEST_IDEAS_TAB, allowIdeasTab ? new int[] { 1, 1 } : noIdeasTab, + allowIdeasTab ? new int[] { 0, 1 } : noIdeasTab, new String[] { "ideas-tab-diabled", "ideas-tab-enabled" }); //$NON-NLS-1$ //$NON-NLS-2$ } public static final String AB_TEST_IDEAS_TAB = "ideasTab"; //$NON-NLS-1$