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

Image not loading with fragment integration #181

Closed
ensozos opened this issue Jan 19, 2021 · 7 comments
Closed

Image not loading with fragment integration #181

ensozos opened this issue Jan 19, 2021 · 7 comments
Labels
wontfix This will not be worked on

Comments

@ensozos
Copy link

ensozos commented Jan 19, 2021

Images are not getting loaded on Android 5.1.1 when you integrate Compose and fragments (inflate the XML layout using AndroidViewBinding). You can reproduce the issue on the Jetsnack sample app by adding a CoilImage on the ConversationContent (or in any other composable). CoilImage works fine for Android > 5.1

@chrisbanes
Copy link
Contributor

Some questions:

What device are you finding this on? What url/image are attempting to load?

@ensozos
Copy link
Author

ensozos commented Jan 19, 2021

We've tested this on 2 old devices, Xiaomi Redmi 3 and ZTE Nubia Z11 Max.
We tried several URL/images such as "https://source.unsplash.com/pGM4sjt_BdQ" (from Jetsnack sample) or load from the asset folder. Also, we found out that the images are getting loaded correctly when the main activity is restarted (pressing the home button and open via recent).

@chrisbanes
Copy link
Contributor

Just ran out tests and sample app on API 21-24 emulators and everything is working as expected. I don't have those devices so there's not much else I can do to help unfortunately.

Is anything coming up in logcat?

@chrisbanes chrisbanes added the wontfix This will not be worked on label Jan 20, 2021
@ensozos
Copy link
Author

ensozos commented Jan 20, 2021

No, we are not getting errors in logcat. The image state is ImageLoadState.Success, but it isn't displayed on the screen. We have also found that the images are displayed if you add a ScrollableRow with CoilImages and scroll or click the row. I believe that this has something to do with the Focus or the Recomposer, not directly with the Coil library.

@chrisbanes
Copy link
Contributor

Are you using fadeIn = true? Maybe it's an animation bug (try turning it off if so).

Does the following work?

CoilImage(...) { imageState ->
    when (imageState) {
        is ImageLoadState.Success -> {
            Image(painter = imageState.painter)
        }
        else -> Unit
    }
}

@ensozos
Copy link
Author

ensozos commented Jan 20, 2021

Are you using fadeIn = true?

We do not use fadeIn or any other animation on the app.

Does the following work?

It does not work. The only way to make this work is if remove the AndroidViewBinding(ContentMainBinding::inflate) (remove fragment integration) and call the Composables from the MainActivity.

@chrisbanes
Copy link
Contributor

Sounds like a bug to me then on AndroidViewBinding. Raise a bug on the tracker?

I'll close this for now, since I don't think there's anything actionable for this library.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

2 participants