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
--- 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;