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

[Guide] Refresh blurview not updated after glide image loaded successfully #169

Open
nguyenvp08 opened this issue Mar 16, 2022 · 6 comments

Comments

@nguyenvp08
Copy link

Thank for your helpful library, I have a problem that I use a ViewPager for display images and the blurview is on top of these images but the images need time to be loaded and after they're loaded successful the blurview not updated to show correct blur. So how to solve this issue ? do I need to create a listener for these images to notify when the images are loaded and then requestLayout for the blurview ? or any help from your library ? Thank a lot

@Dimezis
Copy link
Owner

Dimezis commented Mar 16, 2022

Can you please show your BlurView setup code?
Theoretically, you don't need to do anything extra. But you can try to call invalidate on BlurView after the images are loaded.
Let me know if that worked

@nguyenvp08
Copy link
Author

nguyenvp08 commented Mar 16, 2022

hi @Dimezis, I used the code setup as below :

                viewBinding.blurView.setupWith(viewBinding.layoutRoot as ViewGroup)
                    .setFrameClearDrawable(windowBg)
                    .setBlurAlgorithm(RenderScriptBlur(it))
                    .setBlurRadius(1.0F)
                    .setBlurAutoUpdate(true)
                    .setHasFixedTransformationMatrix(false)
            }

This setup code will be call at onCreate of the fragment. After an api called successfully I make the blur view visible as the same time the image is loading. Then sometimes the blur view showed the correct blur effect, but sometimes it didn't. I just make a test to delay the visibility of blur view about 300ms after image is loaded, then it always show correct blur effect.

I also tried the invalidate function on blur view but it is not update because of this :

if (canvas instanceof BlurViewCanvas) {
            return false;
        }

When the screen is off and turn on again the RecordingCanvas is pass to the updateBlur function and the blur show correct blur effect

@Dimezis
Copy link
Owner

Dimezis commented Mar 16, 2022

Do you have some animation running on those ImageViews when the image is loaded?

@nguyenvp08
Copy link
Author

nguyenvp08 commented Mar 17, 2022

Do you have some animation running on those ImageViews when the image is loaded?

I don't use any animation when loading images, but there is a place holder image, i think the blur view make a blur effect on that place holder image, and after image is loaded successfully, it can not be updated.

@elza-khamdeeva
Copy link

elza-khamdeeva commented Dec 16, 2023

@Dimezis hello, is there any updates on this issue?

@Dimezis
Copy link
Owner

Dimezis commented Dec 16, 2023

@elza-khamdeeva I haven't been able to reproduce it. A working test project would help

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

3 participants