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

Don't let Glide clear the old image on Android ImageView unless we get an error #23313

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

albyrock87
Copy link
Contributor

@albyrock87 albyrock87 commented Jun 27, 2024

Description of Change

This post explains very well how Glide works: they replace the image with a placeholder (null if not specified in the configuration) right before loading the new one.

This causes a slight flickering on the ImageView while changing the image source.

To reproduce this, and verify the fix, I've used the code in issue #6625, which apparently is not entirely fixed on Android.

We have to clear the image only if there was an error loading the new one.
To test the error use case I've added a fake url in the code sample above (i.e. "https://what.is.this.url.com/nonsenseimage1234567.jpg").

I could have cleared the image without creating the cleared field, but I wanted to keep part of the existing behavior somehow.

Before

before.mov

After

after.mov

@albyrock87 albyrock87 requested a review from a team as a code owner June 27, 2024 10:49
Copy link
Contributor

Hey there @albyrock87! Thank you so much for your PR! Someone from the team will get assigned to your PR shortly and we'll get it reviewed.

@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Jun 27, 2024
@albyrock87
Copy link
Contributor Author

@mattleibow I guess you're the expert on this :)

this.callback = callback;
}

@Override
protected void onResourceCleared(@Nullable Drawable placeholder) {
this.view.setImageDrawable(placeholder);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

placeholder is always null here because we never set it on the configuration

Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The only other suggestion, I think they build maui.aar and commit it? So, developers in main can work without the gradle build succeeding?

@PureWeen PureWeen added the area-controls-image Image control label Jun 28, 2024
Copy link
Member

@jonathanpeppers jonathanpeppers left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks OK to me, but we might need someone to manually test. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-controls-image Image control community ✨ Community Contribution
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants