Bug 1411657: Use resources when getting default Pocket value. r=liuche
authorMichael Comella <michael.l.comella@gmail.com>
Wed, 25 Oct 2017 12:02:14 -0700
changeset 388285 4dc6374aca242ffbc01a5fa6db11c6f9933cd0f7
parent 388284 b73eab93e81995fb0643b8ab8d4a004bd795ef58
child 388286 38345cd61a3dd70fafc8e8bb3128b0ac8eb6ac41
push id32746
push useracraciun@mozilla.com
push dateThu, 26 Oct 2017 09:19:46 +0000
treeherdermozilla-central@485a03afaa23 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersliuche
bugs1411657
milestone58.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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());