maui icon indicating copy to clipboard operation
maui copied to clipboard

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

Open albyrock87 opened this issue 1 year ago • 2 comments

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

albyrock87 avatar Jun 27 '24 10:06 albyrock87

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

albyrock87 avatar Jun 27 '24 10:06 albyrock87

/rebase

PureWeen avatar Jul 20 '24 17:07 PureWeen

/azp run

PureWeen avatar Jul 20 '24 17:07 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jul 20 '24 17:07 azure-pipelines[bot]

Good catch @PureWeen , I wasn't aware of this. I'll seek for a safer solution.

albyrock87 avatar Jul 20 '24 18:07 albyrock87

A potential fix for https://github.com/dotnet/maui/issues/14471

kubaflo avatar Jul 21 '24 01:07 kubaflo

/azp run

PureWeen avatar Jul 22 '24 21:07 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jul 22 '24 21:07 azure-pipelines[bot]

/azp run

PureWeen avatar Jul 24 '24 16:07 PureWeen

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jul 24 '24 16:07 azure-pipelines[bot]

Azure Pipelines successfully started running 3 pipeline(s).

azure-pipelines[bot] avatar Jul 31 '24 08:07 azure-pipelines[bot]

I'm closing this PR in favor of:

  • #23830
  • #24021
  • A future PR including freeze workaround from https://github.com/dotnet/maui/pull/23830/commits/14a8202f5b44a46547330ec30aff3798fcbcc2b6 to fix #6625 in all use cases on Android

albyrock87 avatar Aug 05 '24 17:08 albyrock87