maui
maui copied to clipboard
Don't let Glide clear the old image on Android ImageView unless we get an error
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
https://github.com/dotnet/maui/assets/1423005/bfa0845c-df78-49f2-9ed7-f5d47673a492
After
https://github.com/dotnet/maui/assets/1423005/ac19fd71-c98c-4c0d-833b-422178ddbb0a
@mattleibow I guess you're the expert on this :)
/rebase
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
Good catch @PureWeen , I wasn't aware of this. I'll seek for a safer solution.
A potential fix for https://github.com/dotnet/maui/issues/14471
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
/azp run
Azure Pipelines successfully started running 3 pipeline(s).
Azure Pipelines successfully started running 3 pipeline(s).
I'm closing this PR in favor of:
- #23830
- #24021
- A future PR including
freezeworkaround from https://github.com/dotnet/maui/pull/23830/commits/14a8202f5b44a46547330ec30aff3798fcbcc2b6 to fix #6625 in all use cases on Android