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

BlurView doesn't provide dynamic blur for BottomSheetDialogFragment #216

Closed
hmmmk opened this issue Jul 19, 2024 · 19 comments
Closed

BlurView doesn't provide dynamic blur for BottomSheetDialogFragment #216

hmmmk opened this issue Jul 19, 2024 · 19 comments

Comments

@hmmmk
Copy link

hmmmk commented Jul 19, 2024

I'm trying to make dynamic blur for a BottomSheetDialog fragment. But the thing is, that BlurView correctly takes snapshot of underlying content and blurs it, but only statically. When I'm trying to move my bottom sheet fragment up and down, blur remains the same, and I want to make it to change when bottom sheet is moving.

Here is how I enable it in the kotlin code:

val rootView = requireActivity().window.decorView as ViewGroup
            bgView.setupWith(rootView)
                .setBlurRadius(10f)
                .setBlurAutoUpdate(true)

In the XML layout of BottomSheetDialogFragment, BlurView is just top element of all hierarchy.

@Dimezis
Copy link
Owner

Dimezis commented Jul 19, 2024

I have a suspicion about the root cause.
It would help if you could share a sample project

@hmmmk
Copy link
Author

hmmmk commented Jul 22, 2024

@Dimezis can I invite you to a closed repo with the project itself? I think it's better to you to check this one in real-case scenario. I will point to the files where I set up BlurView

@Dimezis
Copy link
Owner

Dimezis commented Jul 22, 2024

Sure, that would work for me too

@hmmmk
Copy link
Author

hmmmk commented Jul 22, 2024

@Dimezis sent an invite. The BlurView is used in PurchaseFragmentBottomSheet.kt at line 101

@hmmmk
Copy link
Author

hmmmk commented Jul 24, 2024

@Dimezis any updates on this issue?

@Dimezis
Copy link
Owner

Dimezis commented Jul 24, 2024

@hmmmk I am not able to go through the signup process in your app, please just extract the problematic place into a separate example project, or provide a simple way to reproduce the issue in this project.

@hmmmk
Copy link
Author

hmmmk commented Jul 24, 2024

@Dimezis okay, I made a branch called blurtest. If you build this branch it will open screen where you should just press on a button with a big heart, it will open BottomSheetFragment, and you'll see the issue

@Dimezis
Copy link
Owner

Dimezis commented Jul 25, 2024

I don't see the bottom sheet
Screenshot_20240725_102443

@hmmmk
Copy link
Author

hmmmk commented Jul 25, 2024

@Dimezis
telegram-cloud-photo-size-2-5264830719312648738-y
Go to the first page and press on the button that I highlited on a screenshot

@Dimezis
Copy link
Owner

Dimezis commented Jul 25, 2024

Version 2.0.5 should fix this issue.
But you also have a different problem - you select a rootView that doesn't include the bottom bar, so it's not getting blurred.

@hmmmk
Copy link
Author

hmmmk commented Jul 25, 2024

Version 2.0.5 should fix this issue. But you also have a different problem - you select a rootView that doesn't include the bottom bar, so it's not getting blurred.

But I select rootView of the whole activity, how it doesn't include bottom bar?

@Dimezis
Copy link
Owner

Dimezis commented Jul 25, 2024

But I select rootView of the whole activity, how it doesn't include bottom bar?

You don't. Well, not on this branch anyway.
This code from your first post is nowhere to be seen in your project.

val rootView = requireActivity().window.decorView as ViewGroup
bgView.setupWith(rootView)

Your setup looks like this instead:

val rootView = requireParentFragment().requireParentFragment().requireParentFragment().view as ViewGroup
bgView.setupWith(rootView)

@hmmmk
Copy link
Author

hmmmk commented Jul 25, 2024

But I select rootView of the whole activity, how it doesn't include bottom bar?

You don't. Well, not on this branch anyway. This code from your first post is nowhere to be seen in your project.

val rootView = requireActivity().window.decorView as ViewGroup
bgView.setupWith(rootView)

Your setup looks like this instead:

val rootView = requireParentFragment().requireParentFragment().requireParentFragment().view as ViewGroup
bgView.setupWith(rootView)

Yep, you right. I forgot about this. But anyway, I tried to put 2.0.5 and it's still not working as expected

@krupalivaghasiya24
Copy link

krupalivaghasiya24 commented Jul 25, 2024

@Dimezis
I tried version-2.0.5 but getting this error

Could not find com.github.Dimezis:BlurView:version-2.0.5.
2.0.4 is working fine for me

implementation ("com.github.Dimezis:BlurView:version-2.0.5")

@janbolat
Copy link

@Dimezis
Copy link
Owner

Dimezis commented Jul 25, 2024

@krupalivaghasiya24
@janbolat
Should be good now

@hmmmk
Copy link
Author

hmmmk commented Jul 31, 2024

@Dimezis any ideas on how to improve performance when using BlurView as BottomSheetDialogFragment background?

@Dimezis
Copy link
Owner

Dimezis commented Jul 31, 2024

RenderEffectBlur should be more performant

@hmmmk
Copy link
Author

hmmmk commented Jul 31, 2024

@Dimezis okay, despite that, the issue is solved

@hmmmk hmmmk closed this as completed Jul 31, 2024
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

4 participants