Bug 1411657: Use resources when getting default Pocket value. r=liuche draft
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 25 Oct 2017 12:02:14 -0700
changeset 686338 8a451817fdf318f8ff2f8536c386e320d88fe293
parent 686335 a97fb1c39d51a7337b46957bde4273bd308b796a
child 686339 9bb693e83ec98a8c1bae6476b2c800cf89968bd3
push id86168
push usermichael.l.comella@gmail.com
push dateWed, 25 Oct 2017 19:05:50 +0000
reviewersliuche
bugs1411657
milestone58.0a1
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
mobile/android/base/java/org/mozilla/gecko/activitystream/homepanel/ActivityStreamPanel.java
--- 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());