question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Blur disappears when navigating away from and back to view in 1.6.3

See original GitHub issue

Please include:

  1. Library version: 1.6.3. Issue not present in 1.6.2.
  2. Device and OS version: Android Oreo
  3. Detailed steps to reproduce the issue: Create a BlurView, navigate away from the screen and back to it again, blur disappears.

Hi, this lib is still unmatched imo so thank you. I just thought you’d like to know, I have a very basic implementation of a BlurView that mistakenly clears itself if you navigate away from the screen with the view and come back to it. The issue is not there in 1.6.2 and below:

binding.welcomeTitleBlurView.setupWith(binding.welcomeBlurContainer)
                .setBlurAlgorithm(RenderScriptBlur(activity))
                .setBlurRadius(2F)
                .setHasFixedTransformationMatrix(true)

        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            binding.welcomeTitleBlurView.outlineProvider = ViewOutlineProvider.BACKGROUND
            binding.welcomeTitleBlurView.clipToOutline = true
        }

I am blurring in a Fragment’s onCreateView. I noticed if I add a delay of 100ms it successfully blurs when it navigates back, and just in case I made sure to try and perform the blur after it has been laid out using:

    inline fun View.afterMeasured(crossinline f: View.() -> Unit) {
        viewTreeObserver.addOnGlobalLayoutListener(object : ViewTreeObserver.OnGlobalLayoutListener {
            override fun onGlobalLayout() {
                if (measuredWidth > 0 && measuredHeight > 0) {
                    viewTreeObserver.removeOnGlobalLayoutListener(this)
                    f()
                }
            }
        })
    }

So something has changed regarding lifecycle callbacks, or threading or something, not sure which.

Also, I noticed the blurring algorithm seems to stretch or magnify the blurred image differently in the setup I have in 1.6.2 / 1.6.3, whereas from 1.5.0->1.6.1 it is different. My view happens to be a relatively narrow, long view on a 7 inch landscape screen. I think 1.6.1 looks more accurate and doesn’t exhibit the disappearing blur behavior in 1.6.3, so will stick with that for the moment.

Here is 1.6.1 with a blur radius of 2: image

Here is 1.6.2 with a blur radius of 2: image

1.6.2 with an increased blur radius of 8 is better: image

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (10 by maintainers)

github_iconTop GitHub Comments

1reaction
Dimeziscommented, Nov 2, 2020

Honestly, I got too lazy to get it fixed without any hacks, so if that’s working for you, let it stay for now 😃

1reaction
Dimeziscommented, Jul 6, 2020

Thank you for the detailed report. As for the disappearing blur, I guess it’s related to this https://github.com/Dimezis/BlurView/issues/89. There was a small change, posting of some callbacks was removed, and seems like it introduced this bug instead. That’s why your postponing workaround seems to fix it.

Regarding the stretching, I believe it’s related to a change in https://github.com/Dimezis/BlurView/releases/tag/version-1.6.2, I’ve increased the rounding value to 64 to significantly improve the performance on Samsung devices. But apparently I forgot to scale the Y dimension accordingly.

Both should be fixable, but can’t say for sure when I’ll be able to do it

Read more comments on GitHub >

github_iconTop Results From Across the Web

Memory leaks in BlockingBlurController · Issue #89 - GitHub
Hello, @Dimezis I'm using your librray in such way: Activity -> Fragment -> RecyclerView Item with blurred background.
Read more >
Selective Blurring in Adobe Premiere Pro - YouTube
Sometimes you need to blur a logo, or a face in a video and both Premiere Pro and After Effects both have a...
Read more >
.blur() | jQuery API Documentation
This method is a shortcut for .on( "blur", handler ) in the first two variations, and .trigger( "blur" ) in the third. The...
Read more >
Windows 11 blur window bug - Microsoft Community Hub
4. Scroll to the bottom and find "Windows Explorer". 5. Right Click and Click "Restart". 6. There will be a black or white...
Read more >
Why does PKToolPicker disappear when blur and doesn't ...
When the blur effect is applied, the PKToolPicker disappear, but when I remove the effect, the PKToolPicker despot come back, so it is...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found