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

blurhash doesn't seem to work w/ Coil 1.0 #5

Open
kenyee opened this issue Nov 23, 2020 · 2 comments
Open

blurhash doesn't seem to work w/ Coil 1.0 #5

kenyee opened this issue Nov 23, 2020 · 2 comments

Comments

@kenyee
Copy link

kenyee commented Nov 23, 2020

Calling it with:

           image.load(it.imageUrls.small) {
                crossfade(true)
                blurPlaceHolder(it.blurHash, image, blurHash = blurHashHandler)
                { coilImageBuilder ->
                    coilImageBuilder.build()
                }
            }

blurHashHandler is initialized in the fragment like so:

val blurHashHandler = BlurHash(requireContext(), lruSize = 20, punch = 1F)

The images pop into view w/o showing the blurhash placeholder.

@kenyee
Copy link
Author

kenyee commented Nov 23, 2020

hmm...could be related to the use of a gridlayout and constraintlayout fit sizing...image width/height is zero in the viewholder bind...
If I do this, it semi works but then you have a race condition w/ Coil so sometimes the images don't load properly and only the blurhash remains :-(

            blurHashHandler.execute(it.blurHash, 100, 100) { bitmapDrawable ->
                image.setImageDrawable(bitmapDrawable)
            }
            image.load(it.imageUrls.small) {
                crossfade(true)
            }

@kenyee
Copy link
Author

kenyee commented Nov 23, 2020

this seems to work:

            image.load(it.imageUrls.small) {
                crossfade(true)
                blurPlaceHolder(it.blurHash, blurImageSizePx, blurImageSizePx, blurHash = blurHashHandler)
                { coilImageBuilder ->
                    coilImageBuilder.build()
                }
            }

but it's fairly slow generating the blur hash so the background stays white for a while

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant