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

Wrong activity background blurring effect #178

Open
luongvo opened this issue May 17, 2022 · 6 comments
Open

Wrong activity background blurring effect #178

luongvo opened this issue May 17, 2022 · 6 comments
Labels

Comments

@luongvo
Copy link

luongvo commented May 17, 2022

Please include:

  1. Library version: version-2.0.0
  2. Device and OS version: all API versions, tested on API 23 and 30
  3. Detailed steps to reproduce the issue
  • Added a new transparent fragment
  • Added a android:windowBackground attr
  • Checkout the blurring effect on topBlurView on transparent fragment
  1. XML layout and code for BlurView setup: Reproduce commit here luongvo@6835fd2

  2. Stacktrace in case of a crash: None

Expected: set android:background="@drawable/lines" in activity_main.xml could produce an expected result

expected.mp4

Actual: using <item name="android:windowBackground">@drawable/lines</item> in AppTheme and .setFrameClearDrawable(windowBackground) set in MainActivity does not work properly.

actual.mp4
@Dimezis Dimezis added the bug label May 17, 2022
@Dimezis
Copy link
Owner

Dimezis commented May 17, 2022

Apparently, there's some weird bug with android:windowBackground as an image (BitmapDrawable).
I'll see what I can do about it, but be aware that even regardless of this bug, your Expected result is probably impossible with setFrameClearDrawable, because the drawable doesn't have a trackable position on the screen.

That means, that even if I fix the bug, the bottom BlurView won't be able to properly blur the bottom of this drawable.

To fix this, you can either pass the (ViewGroup) getWindow().getDecorView() as a rootView, or set the background in activity_main.xml as you did.

@luongvo
Copy link
Author

luongvo commented May 17, 2022

@Dimezis I tried to apply using getWindow().getDecorView() but it does not work.

This lib https://github.com/mmin18/RealtimeBlurView using the same approach but it works properly, here is the POC luongvo/RealtimeBlurView@b87607a. The bad thing is https://github.com/mmin18/RealtimeBlurView does not support latest API RenderEffect from API 31 and discontinued.

RealtimeBlurView-poc.mp4

I think even there are some issues, we should support getWindow().getDecorView() directly from this nice library instead.

@Dimezis
Copy link
Owner

Dimezis commented May 17, 2022

I tried to apply using getWindow().getDecorView() but it does not work.

Can you post a commit with this change?
It works fine for me on your branch

@luongvo
Copy link
Author

luongvo commented May 17, 2022

@Dimezis I made a draft PR here, please check it out #179 🙏

The update from the PR above still does not work:

Actual:

Expected:

@luongvo
Copy link
Author

luongvo commented May 17, 2022

@Dimezis
Copy link
Owner

Dimezis commented May 17, 2022

Responded - #179 (comment)

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

No branches or pull requests

2 participants