Bug 1322564 - Permit loading icons from network for Activitystream r?sebastian draft
authorAndrzej Hunt <ahunt@mozilla.com>
Mon, 06 Feb 2017 15:37:50 -0800
changeset 479577 35ea8a423bdf9b4232a823c525509e492e88a5cc
parent 479455 12c02bf624c48903b155428f7c8a419ba7a333a6
child 544732 39c9461dde2c4c518d301391bd5f8058b46b6ab8
push id44303
push userahunt@mozilla.com
push dateMon, 06 Feb 2017 23:38:55 +0000
reviewerssebastian
bugs1322564
milestone54.0a1
Bug 1322564 - Permit loading icons from network for Activitystream r?sebastian Assuming the following, loading icons for the network isn't a bad idea: - ActivityStream has relatively few items (in comparison to history/bookmarks) - (And only some of those may be synced - i.e. have no icon) - We only load network icons if locally cached versions aren't available - We ignore previously failed URLs (i.e. we don't repeatedly waste bandwidth if an image isn't available) As a consequence, we're only likely to attempt to load very few icons, meaning data usage is low. AS is intended to be the primary screen that users (repeatedly) see, optimising the appearance here is therefore worthwhile (moreover good icons should help with recognising specific sites faster). Note: we don't do the same for the AS context menu: by the time the menu is opened, an icon should hopefully be available locally. Conceivably the icon could finish loading while the menu is showing, but it seems that would be a very rare scenario. MozReview-Commit-ID: KtzX8knQWfB
mobile/android/base/java/org/mozilla/gecko/home/activitystream/stream/HighlightItem.java
mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesCard.java
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/stream/HighlightItem.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/stream/HighlightItem.java
@@ -116,17 +116,16 @@ public class HighlightItem extends Strea
         updatePage();
 
         if (ongoingIconLoad != null) {
             ongoingIconLoad.cancel(true);
         }
 
         ongoingIconLoad = Icons.with(itemView.getContext())
                 .pageUrl(highlight.getUrl())
-                .skipNetwork()
                 .build()
                 .execute(this);
     }
 
     private void updateUiForSource(Utils.HighlightSource source) {
         switch (source) {
             case BOOKMARKED:
                 vSourceView.setText(R.string.activity_stream_highlight_label_bookmarked);
--- a/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesCard.java
+++ b/mobile/android/base/java/org/mozilla/gecko/home/activitystream/topsites/TopSitesCard.java
@@ -95,17 +95,16 @@ import java.util.concurrent.Future;
         });
 
         if (ongoingIconLoad != null) {
             ongoingIconLoad.cancel(true);
         }
 
         ongoingIconLoad = Icons.with(itemView.getContext())
                 .pageUrl(topSite.getUrl())
-                .skipNetwork()
                 .build()
                 .execute(this);
 
         final Drawable pinDrawable;
         if (topSite.isPinned()) {
             pinDrawable = DrawableUtil.tintDrawable(itemView.getContext(), R.drawable.as_pin, itemView.getResources().getColor(R.color.placeholder_grey));
         } else {
             pinDrawable = null;