Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update favIconHandler's context on RssItemViewHolder bind #1405

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ public void bind(@NonNull RssItem rssItem) {


ImageView imgViewFavIcon = getImageViewFavIcon();
favIconHandler.setContext(itemView.getContext());
if (imgViewFavIcon != null) {
favIconHandler.loadFavIconForFeed(favIconUrl, imgViewFavIcon, Math.round((marginFavIcon - sizeOfFavIcon) / 2f));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,8 @@
public class FavIconHandler {
private static final String TAG = FavIconHandler.class.getCanonicalName();

private final RequestManager mGlide;
private final Context mContext;
private RequestManager mGlide;
private Context mContext;
private final int mPlaceHolder;

public FavIconHandler(Context context) {
Expand Down Expand Up @@ -155,4 +155,12 @@ private void UpdateAvgColorOfFeed(long feedId, Bitmap bitmap, Context context) {
Log.v(TAG, "Failed to update AVG color of feed: " + feedId);
}
}

public void setContext(Context context) {
if (context == mContext) {
return;
}
mContext = context;
mGlide = Glide.with(context);
}
}