Kill featured lists

pull/14/head
Sam Bosley 11 years ago
parent 57ee4e3492
commit 3aac9f082b

@ -6,9 +6,7 @@
package com.todoroo.astrid.actfm.sync;
import java.io.IOException;
import java.util.concurrent.atomic.AtomicInteger;
import org.json.JSONException;
import org.json.JSONObject;
import com.timsu.astrid.GCMIntentService;
@ -73,8 +71,6 @@ public class ActFmSyncV2Provider extends SyncV2Provider {
return actFmPreferenceService.isLoggedIn();
}
private static final String LAST_FEATURED_TAG_FETCH_TIME = "actfm_last_featuredTag"; //$NON-NLS-1$
// --- synchronize active tasks
@Override
@ -84,13 +80,9 @@ public class ActFmSyncV2Provider extends SyncV2Provider {
new Thread(new Runnable() {
public void run() {
final AtomicInteger finisher = new AtomicInteger(1);
updateUserStatus();
ActFmSyncThread.getInstance().setTimeForBackgroundSync(true);
startFeaturedListFetcher(finisher);
}
}).start();
}
@ -129,30 +121,6 @@ public class ActFmSyncV2Provider extends SyncV2Provider {
}
}
/** fetch changes to tags */
private void startFeaturedListFetcher(final AtomicInteger finisher) {
new Thread(new Runnable() {
@Override
public void run() {
int time = Preferences.getInt(LAST_FEATURED_TAG_FETCH_TIME, 0);
try {
if (Preferences.getBoolean(R.string.p_show_featured_lists, 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) {
handler.handleException("actfm-sync", e, e.toString()); //$NON-NLS-1$
} finally {
if(finisher.decrementAndGet() == 0) {
finishSync(null);
}
}
}
}).start();
}
// --- synchronize list
@Override
public void synchronizeList(Object list, final boolean manual,

@ -402,6 +402,16 @@ public class AstridNewSyncMigrator {
Log.e(LOG_TAG, "Error validating task to tag metadata", e);
}
// --------------
// Delete all featured list data
// --------------
try {
tagDataDao.deleteWhere(Functions.bitwiseAnd(TagData.FLAGS, TagData.FLAG_FEATURED).gt(0));
} catch (Exception e) {
Log.e(LOG_TAG, "Error deleting featured list data", e);
}
// --------------
// Finally, create oustanding entries for tags on unsynced tasks
// --------------

@ -64,8 +64,6 @@
<!-- force tablets to use phone layout -->
<string name="p_force_phone_layout">force_phone_layout</string>
<!-- show featured lists -->
<!-- account status section key -->
<string name="p_account">account</string>
@ -90,7 +88,6 @@
<string name="p_menu_items">p_menu_items</string>
<string name="p_show_menu_search">p_show_menu_search</string>
<string name="p_show_menu_friends">p_show_menu_friends</string>
<string name="p_show_featured_lists">p_show_featured_lists_labs</string>
<string name="p_show_menu_sync">p_show_menu_sync</string>
<string name="p_show_menu_sort">p_show_menu_sort</string>
<string name="p_show_menu_addons">p_show_menu_addons</string>

@ -104,10 +104,6 @@
android:key="@string/p_show_menu_friends"
android:title="@string/TLA_menu_friends"
android:defaultValue="true"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_show_featured_lists"
android:title="@string/EPr_show_featured_lists"
android:defaultValue="true"/>
<com.todoroo.astrid.ui.MultilineCheckboxPreference
android:key="@string/p_show_menu_sync"
android:title="@string/TLA_menu_sync"

@ -3,7 +3,6 @@ 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;
@ -13,10 +12,7 @@ public class DefaultFilterMode implements FilterModeSpec {
@Override
public int[] getForbiddenMenuItems() {
if (Preferences.getBoolean(R.string.p_show_featured_lists, false))
return new int[0];
else
return new int[] { MainMenuPopover.MAIN_MENU_ITEM_FEATURED_LISTS };
return new int[] { MainMenuPopover.MAIN_MENU_ITEM_FEATURED_LISTS };
}
@Override

@ -600,14 +600,6 @@ public class EditPreferences extends TodorooPreferenceActivity {
return super.onPreferenceChange(p, newValue);
}
});
} else if (r.getString(R.string.p_show_featured_lists).equals(preference.getKey())) {
preference.setOnPreferenceChangeListener(new SetResultOnPreferenceChangeListener(SyncProviderPreferences.RESULT_CODE_SYNCHRONIZE) {
@Override
public boolean onPreferenceChange(Preference p, Object newValue) {
StatisticsService.reportEvent(StatisticsConstants.PREF_SHOW_FEATURED_LISTS, "enabled", newValue.toString()); //$NON-NLS-1$
return super.onPreferenceChange(p, newValue);
}
});
}
else if (r.getString(R.string.p_voiceInputEnabled).equals(preference.getKey())) {
if (value != null && !(Boolean)value)
@ -673,7 +665,7 @@ public class EditPreferences extends TodorooPreferenceActivity {
findPreference(getString(R.string.p_config_lite)).setOnPreferenceClickListener(
new SetDefaultsClickListener(new AstridLitePreferenceSpec(), R.string.EPr_config_lite, StatisticsConstants.PREFS_RESET_LITE));
int[] menuPrefs = { R.string.p_show_menu_search, R.string.p_show_menu_friends, R.string.p_show_featured_lists,
int[] menuPrefs = { R.string.p_show_menu_search, R.string.p_show_menu_friends,
R.string.p_show_menu_sync, R.string.p_show_menu_sort, R.string.p_show_menu_addons
};
for (int key : menuPrefs) {

@ -22,7 +22,6 @@ import android.widget.TextView;
import com.timsu.astrid.R;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.service.ThemeService;
import com.todoroo.astrid.tags.reusable.FeaturedListFilterExposer;
import com.todoroo.astrid.ui.TouchInterceptingFrameLayout.InterceptTouchListener;
import com.todoroo.astrid.utility.AstridPreferences;
@ -122,12 +121,6 @@ public class MainMenuPopover extends FragmentPopover implements InterceptTouchLi
ThemeService.getDrawable(R.drawable.icn_menu_friends, themeFlags),
MAIN_MENU_ITEM_FRIENDS, null, topFixed);
if (Preferences.getBoolean(FeaturedListFilterExposer.PREF_SHOULD_SHOW_FEATURED_LISTS, false)
&& Preferences.getBoolean(R.string.p_show_featured_lists, false))
addMenuItem(R.string.TLA_menu_featured_lists,
ThemeService.getDrawable(R.drawable.icn_featured_lists, themeFlags),
MAIN_MENU_ITEM_FEATURED_LISTS, null, topFixed);
addMenuItem(R.string.TLA_menu_settings,
ThemeService.getDrawable(R.drawable.icn_menu_settings, themeFlags),
MAIN_MENU_ITEM_SETTINGS, null, bottomFixed); // Settings item

@ -109,7 +109,6 @@ public class AstridDefaultPreferenceSpec extends AstridPreferenceSpec {
setPreference(prefs, editor, r, R.string.p_show_menu_search, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_friends, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_featured_lists, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_sync, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_sort, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_addons, true, ifUnset);

@ -108,7 +108,6 @@ public class AstridLitePreferenceSpec extends AstridPreferenceSpec {
setPreference(prefs, editor, r, R.string.p_show_menu_search, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_friends, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_featured_lists, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_sync, false, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_sort, true, ifUnset);
setPreference(prefs, editor, r, R.string.p_show_menu_addons, false, ifUnset);

@ -12,13 +12,11 @@ import android.content.SharedPreferences;
import com.timsu.astrid.R;
import com.todoroo.andlib.data.TodorooCursor;
import com.todoroo.andlib.service.ContextManager;
import com.todoroo.andlib.sql.Functions;
import com.todoroo.andlib.sql.Query;
import com.todoroo.andlib.utility.AndroidUtilities;
import com.todoroo.andlib.utility.Preferences;
import com.todoroo.astrid.api.AstridApiConstants;
import com.todoroo.astrid.core.PluginServices;
import com.todoroo.astrid.data.TagData;
import com.todoroo.astrid.data.User;
import com.todoroo.astrid.service.UpgradeService;
import com.todoroo.astrid.tags.reusable.FeaturedListFilterExposer;
@ -93,16 +91,7 @@ public class AstridPreferences {
}
private static void setShowFeaturedLists() {
// Show featured lists if necessary
boolean showFeaturedLists = false;
TodorooCursor<TagData> featLists = PluginServices.getTagDataService().query(Query.select(TagData.ID)
.where(Functions.bitwiseAnd(TagData.FLAGS, TagData.FLAG_FEATURED).gt(0)).limit(1));
try {
showFeaturedLists = featLists.getCount() > 0;
} finally {
featLists.close();
}
Preferences.setBoolean(FeaturedListFilterExposer.PREF_SHOULD_SHOW_FEATURED_LISTS, showFeaturedLists);
Preferences.setBoolean(FeaturedListFilterExposer.PREF_SHOULD_SHOW_FEATURED_LISTS, false);
}
/* ======================================================================

Loading…
Cancel
Save