Featured lists turned off by default but can be turned on in labs

pull/14/head
Sam Bosley 13 years ago
parent 59fc9e98c9
commit 989fc0b2d8

@ -269,8 +269,10 @@ public class ActFmSyncV2Provider extends SyncV2Provider {
public void run() { public void run() {
int time = Preferences.getInt(LAST_FEATURED_TAG_FETCH_TIME, 0); int time = Preferences.getInt(LAST_FEATURED_TAG_FETCH_TIME, 0);
try { try {
if (Preferences.getBoolean(R.string.p_show_featured_lists_labs, false)) {
time = actFmSyncService.fetchFeaturedLists(time); time = actFmSyncService.fetchFeaturedLists(time);
Preferences.setInt(LAST_FEATURED_TAG_FETCH_TIME, time); Preferences.setInt(LAST_FEATURED_TAG_FETCH_TIME, time);
}
} catch (JSONException e) { } catch (JSONException e) {
handler.handleException("actfm-sync", e, e.toString()); //$NON-NLS-1$ handler.handleException("actfm-sync", e, e.toString()); //$NON-NLS-1$
} catch (IOException e) { } catch (IOException e) {

@ -64,6 +64,9 @@
<!-- force tablets to use phone layout --> <!-- force tablets to use phone layout -->
<string name="p_force_phone_layout">force_phone_layout</string> <string name="p_force_phone_layout">force_phone_layout</string>
<!-- show featured lists -->
<string name="p_show_featured_lists_labs">show_featured_lists_labs</string>
<string-array name="TEA_reminder_random_hours"> <string-array name="TEA_reminder_random_hours">
<!-- values (in hours) associated with items above. --> <!-- values (in hours) associated with items above. -->
<item>1</item> <item>1</item>

@ -663,6 +663,8 @@
<string name="EPr_force_phone_layout">Use phone layout</string> <string name="EPr_force_phone_layout">Use phone layout</string>
<string name="EPr_show_featured_lists">Show featured lists</string>
<string name="EPr_swipe_lists_restart_alert">You will need to restart Astrid for this change to take effect</string> <string name="EPr_swipe_lists_restart_alert">You will need to restart Astrid for this change to take effect</string>
<string-array name="EPr_swipe_lists_performance_mode"> <string-array name="EPr_swipe_lists_performance_mode">

@ -34,5 +34,9 @@
android:title="@string/EPr_force_phone_layout" android:title="@string/EPr_force_phone_layout"
android:key="@string/p_force_phone_layout" android:key="@string/p_force_phone_layout"
android:defaultValue="false"/> android:defaultValue="false"/>
<CheckBoxPreference
android:title="@string/EPr_show_featured_lists"
android:key="@string/p_show_featured_lists_labs"
android:defaultValue="false"/>
</PreferenceScreen> </PreferenceScreen>

@ -3,15 +3,20 @@ package com.todoroo.astrid.activity;
import android.content.Context; import android.content.Context;
import com.timsu.astrid.R; import com.timsu.astrid.R;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.Filter; import com.todoroo.astrid.api.Filter;
import com.todoroo.astrid.api.FilterListItem; import com.todoroo.astrid.api.FilterListItem;
import com.todoroo.astrid.core.CoreFilterExposer; import com.todoroo.astrid.core.CoreFilterExposer;
import com.todoroo.astrid.ui.MainMenuPopover;
public class DefaultFilterMode implements FilterModeSpec { public class DefaultFilterMode implements FilterModeSpec {
@Override @Override
public int[] getForbiddenMenuItems() { public int[] getForbiddenMenuItems() {
if (Preferences.getBoolean(R.string.p_show_featured_lists_labs, false))
return new int[0]; return new int[0];
else
return new int[] { MainMenuPopover.MAIN_MENU_ITEM_FEATURED_LISTS };
} }
@Override @Override

@ -83,6 +83,14 @@ public class AstridPreferences {
Preferences.setString(R.string.p_theme, ThemeService.THEME_WHITE); Preferences.setString(R.string.p_theme, ThemeService.THEME_WHITE);
} }
setShowFriendsView();
setShowFeaturedLists();
editor.commit();
}
private static void setShowFriendsView() {
// Show friends view if necessary // Show friends view if necessary
boolean showFriends = false; boolean showFriends = false;
TodorooCursor<User> users = PluginServices.getUserDao().query(Query.select(User.ID).limit(1)); TodorooCursor<User> users = PluginServices.getUserDao().query(Query.select(User.ID).limit(1));
@ -92,7 +100,10 @@ public class AstridPreferences {
users.close(); users.close();
} }
Preferences.setBoolean(R.string.p_show_friends_view, showFriends); Preferences.setBoolean(R.string.p_show_friends_view, showFriends);
}
private static void setShowFeaturedLists() {
// Show featured lists if necessary
boolean showFeaturedLists = false; boolean showFeaturedLists = false;
TodorooCursor<TagData> featLists = PluginServices.getTagDataService().query(Query.select(TagData.ID) TodorooCursor<TagData> featLists = PluginServices.getTagDataService().query(Query.select(TagData.ID)
.where(Functions.bitwiseAnd(TagData.FLAGS, TagData.FLAG_FEATURED).gt(0)).limit(1)); .where(Functions.bitwiseAnd(TagData.FLAGS, TagData.FLAG_FEATURED).gt(0)).limit(1));
@ -102,8 +113,6 @@ public class AstridPreferences {
featLists.close(); featLists.close();
} }
Preferences.setBoolean(R.string.p_show_featured_lists, showFeaturedLists); Preferences.setBoolean(R.string.p_show_featured_lists, showFeaturedLists);
editor.commit();
} }
/* ====================================================================== /* ======================================================================

Loading…
Cancel
Save