Skip to content
Snippets Groups Projects
Commit d1f43ee3 authored by maniac103's avatar maniac103 Committed by mueller-ma
Browse files

Fix wrong icons being loaded if views are re-used (#979)


There's a condition where widget icons are loaded incorrectly:
- Have a WidgetImageView which just loaded an icon
- Go to another page (previous views are detached)
- Go back to initial page (previous views are reattached, but not
  necessarily in the same spot)
In step 3 of that scenario, views are likely to use a cached bitmap
instead of loading them again, in which case mLastRequest isn't properly
cleared out and re-triggered later when onAttachedToWindow() is called.
As the request points to the URL of the last spot, the wrong icon is
loaded in that case. Fix this by properly clearing out the last request
when assigning a new URL.

Signed-off-by: default avatarDanny Baumann <dannybaumann@web.de>
parent bb1ce542
No related branches found
No related tags found
No related merge requests found
......@@ -115,6 +115,9 @@ public class WidgetImageView extends AppCompatImageView {
}
cancelCurrentLoad();
// Make sure to discard last request (which was for a different URL) to ensure
// it's not re-triggered later, e.g. when being attached to the window
mLastRequest = null;
if (actualUrl == null) {
applyFallbackDrawable();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment