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

Fix android image loading race condition and improve logging #25870

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

Conversation

albyrock87
Copy link
Contributor

Description of Change

This PR aims to solve three issues:

  1. Switching between Shell Tabs destroys the Fragment causing unwanted image unloading:
    Reloading images upon re-attach was handled in Check to see if Image Should Reload When Attached #24023 but we can provide a better UX here and avoid flashes while going back to the initial tab.
  2. Random flashes while scrolling collection view caused by a race condition in image loading:
    Glide is race-condition free, but we were setting the Drawable asynchronously in the next loop, this may generate glitches under some scrolling condition in collection view
  3. It's really hard to debug our beloved Glide integration:
    I've added proper logging mechanics which can be enabled via adb before running the application:
    adb shell setprop log.tag.Glide VERBOSE
    adb shell setprop log.tag.MauiCustomTarget VERBOSE
    adb shell setprop log.tag.MauiCustomViewTarget VERBOSE
    
    Example logs:
    D Glide   : Finished loading BitmapDrawable from MEMORY_CACHE for FontModel{color=#FF000000, glyph='f111', textSize=84.0, typeface=android.graphics.Typeface@898fd220} with size [-2147483648x-2147483648] in 0.202625 ms
    V MauiCustomViewTarget: onResourceReady: FontModel{color=#FF000000, glyph='f111', textSize=84.0, typeface=android.graphics.Typeface@898fd220}
    

Issues Fixed

#14587
#25783

@albyrock87 albyrock87 requested a review from a team as a code owner November 14, 2024 20:49
@dotnet-policy-service dotnet-policy-service bot added the community ✨ Community Contribution label Nov 14, 2024
@jsuarezruiz jsuarezruiz added the area-image Image loading, sources, caching label Nov 15, 2024
@jsuarezruiz
Copy link
Contributor

/azp run

Copy link

Azure Pipelines successfully started running 3 pipeline(s).

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

Successfully merging this pull request may close these issues.

2 participants