From 989fc0b2d840d35f501c99bb03803824e24bef6b Mon Sep 17 00:00:00 2001 From: Sam Bosley Date: Fri, 17 Aug 2012 17:49:46 -0700 Subject: [PATCH] Featured lists turned off by default but can be turned on in labs --- .../astrid/actfm/sync/ActFmSyncV2Provider.java | 6 ++++-- astrid/res/values/keys.xml | 3 +++ astrid/res/values/strings-core.xml | 2 ++ astrid/res/xml/preferences_labs.xml | 4 ++++ .../todoroo/astrid/activity/DefaultFilterMode.java | 7 ++++++- .../todoroo/astrid/utility/AstridPreferences.java | 13 +++++++++++-- 6 files changed, 30 insertions(+), 5 deletions(-) diff --git a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncV2Provider.java b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncV2Provider.java index 12b0f5da1..1a6b8c480 100644 --- a/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncV2Provider.java +++ b/astrid/plugin-src/com/todoroo/astrid/actfm/sync/ActFmSyncV2Provider.java @@ -269,8 +269,10 @@ public class ActFmSyncV2Provider extends SyncV2Provider { public void run() { int time = Preferences.getInt(LAST_FEATURED_TAG_FETCH_TIME, 0); try { - time = actFmSyncService.fetchFeaturedLists(time); - Preferences.setInt(LAST_FEATURED_TAG_FETCH_TIME, time); + if (Preferences.getBoolean(R.string.p_show_featured_lists_labs, false)) { + time = actFmSyncService.fetchFeaturedLists(time); + Preferences.setInt(LAST_FEATURED_TAG_FETCH_TIME, time); + } } catch (JSONException e) { handler.handleException("actfm-sync", e, e.toString()); //$NON-NLS-1$ } catch (IOException e) { diff --git a/astrid/res/values/keys.xml b/astrid/res/values/keys.xml index 05e1c3153..8a07945cb 100644 --- a/astrid/res/values/keys.xml +++ b/astrid/res/values/keys.xml @@ -64,6 +64,9 @@ force_phone_layout + + show_featured_lists_labs + 1 diff --git a/astrid/res/values/strings-core.xml b/astrid/res/values/strings-core.xml index a2e1f102e..1dcd9767e 100644 --- a/astrid/res/values/strings-core.xml +++ b/astrid/res/values/strings-core.xml @@ -662,6 +662,8 @@ Start calendar events at due time Use phone layout + + Show featured lists You will need to restart Astrid for this change to take effect diff --git a/astrid/res/xml/preferences_labs.xml b/astrid/res/xml/preferences_labs.xml index f5318301a..dd7171e4e 100644 --- a/astrid/res/xml/preferences_labs.xml +++ b/astrid/res/xml/preferences_labs.xml @@ -34,5 +34,9 @@ android:title="@string/EPr_force_phone_layout" android:key="@string/p_force_phone_layout" android:defaultValue="false"/> + diff --git a/astrid/src/com/todoroo/astrid/activity/DefaultFilterMode.java b/astrid/src/com/todoroo/astrid/activity/DefaultFilterMode.java index 7a0c68155..6f01049ec 100644 --- a/astrid/src/com/todoroo/astrid/activity/DefaultFilterMode.java +++ b/astrid/src/com/todoroo/astrid/activity/DefaultFilterMode.java @@ -3,15 +3,20 @@ package com.todoroo.astrid.activity; import android.content.Context; import com.timsu.astrid.R; +import com.todoroo.andlib.utility.Preferences; import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.core.CoreFilterExposer; +import com.todoroo.astrid.ui.MainMenuPopover; public class DefaultFilterMode implements FilterModeSpec { @Override public int[] getForbiddenMenuItems() { - return new int[0]; + if (Preferences.getBoolean(R.string.p_show_featured_lists_labs, false)) + return new int[0]; + else + return new int[] { MainMenuPopover.MAIN_MENU_ITEM_FEATURED_LISTS }; } @Override diff --git a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java index 2c08a700e..42ef87485 100644 --- a/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java +++ b/astrid/src/com/todoroo/astrid/utility/AstridPreferences.java @@ -83,6 +83,14 @@ public class AstridPreferences { Preferences.setString(R.string.p_theme, ThemeService.THEME_WHITE); } + setShowFriendsView(); + + setShowFeaturedLists(); + + editor.commit(); + } + + private static void setShowFriendsView() { // Show friends view if necessary boolean showFriends = false; TodorooCursor users = PluginServices.getUserDao().query(Query.select(User.ID).limit(1)); @@ -92,7 +100,10 @@ public class AstridPreferences { users.close(); } Preferences.setBoolean(R.string.p_show_friends_view, showFriends); + } + private static void setShowFeaturedLists() { + // Show featured lists if necessary boolean showFeaturedLists = false; TodorooCursor featLists = PluginServices.getTagDataService().query(Query.select(TagData.ID) .where(Functions.bitwiseAnd(TagData.FLAGS, TagData.FLAG_FEATURED).gt(0)).limit(1)); @@ -102,8 +113,6 @@ public class AstridPreferences { featLists.close(); } Preferences.setBoolean(R.string.p_show_featured_lists, showFeaturedLists); - - editor.commit(); } /* ======================================================================