Bug 1411657: Use resources when getting default Pocket value. r=liuche
This is an existing bug that previously had no impact because the values were
duplicated. Now that I'm going to change the value, the bug has to be fixed.
I opted not to fix the bug for the other top sites features in order to
minimize the scope of this change.
MozReview-Commit-ID: L9bnEMfvpDG
--- a/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/ActivityStreamPanel.java
+++ b/mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/ActivityStreamPanel.java
@@ -106,18 +106,21 @@ public class ActivityStreamPanel extends
}
public void load(LoaderManager lm) {
lm.initLoader(LOADER_ID_TOPSITES, null, new TopSitesCallback());
if (sharedPreferences.getBoolean(PREF_BOOKMARKS_ENABLED, true) || sharedPreferences.getBoolean(PREF_VISITED_ENABLED, true)) {
lm.initLoader(LOADER_ID_HIGHLIGHTS, null, new HighlightsCallbacks());
}
- if (ActivityStreamConfiguration.isPocketEnabledByLocale(getContext()) &&
- sharedPreferences.getBoolean(PREF_POCKET_ENABLED, true)) {
+ // TODO: we should get the default values from resources for the other Top Sites sections above too.
+ final Context context = getContext();
+ final Resources res = getContext().getResources();
+ if (ActivityStreamConfiguration.isPocketEnabledByLocale(context) &&
+ sharedPreferences.getBoolean(PREF_POCKET_ENABLED, res.getBoolean(R.bool.pref_activitystream_pocket_enabled_default))) {
lm.initLoader(LOADER_ID_POCKET, null, new PocketStoriesCallbacks());
}
}
public void unload() {
adapter.swapHighlights(Collections.<Highlight>emptyList());