Bug 1411657 - Use resources when getting default Pocket value. r=liuche, a=ritu
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 25 Oct 2017 12:02:14 -0700
changeset 432789 f99471c1c261403be073cb2fe516f58affedb9ae
parent 432788 18fc5fc8bf7c695329cbb92f2e2d04e630398d79
child 432790 ae4b19c61dc754940b570be2dcef2464429d032b
push id8060
push userryanvm@gmail.com
push dateThu, 26 Oct 2017 18:20:20 +0000
treeherdermozilla-beta@c060b92db7ee [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche, ritu
bugs1411657
milestone57.0
Bug 1411657 - Use resources when getting default Pocket value. r=liuche, a=ritu 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());