Open luongvo opened 2 years ago
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.
@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 https://github.com/luongvo/RealtimeBlurView/commit/b87607a7fb1f76841b4cdd8f828a7c12949751b4. The bad thing is https://github.com/mmin18/RealtimeBlurView does not support latest API RenderEffect
from API 31 and discontinued.
I think even there are some issues, we should support getWindow().getDecorView()
directly from this nice library instead.
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
@Dimezis I made a draft PR here, please check it out https://github.com/Dimezis/BlurView/pull/179 🙏
The update from the PR above still does not work:
Actual:
Expected:
@Dimezis I think this logic could help https://github.com/mmin18/RealtimeBlurView/blob/master/library/src/com/github/mmin18/widget/RealtimeBlurView.java#L245-L261 🤔
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 issueandroid:windowBackground
attr4) XML layout and code for BlurView setup: Reproduce commit here https://github.com/luongvo/BlurView/commit/6835fd2b97593ec5eaf794d28f9c53a2a6953168
5) Stacktrace in case of a crash: None
Expected: set
android:background="@drawable/lines"
inactivity_main.xml
could produce an expected resulthttps://user-images.githubusercontent.com/16315358/168729864-0a766a4c-7948-4954-8eed-a87b10978593.mp4
Actual: using
<item name="android:windowBackground">@drawable/lines</item>
in AppTheme and.setFrameClearDrawable(windowBackground)
set inMainActivity
does not work properly.https://user-images.githubusercontent.com/16315358/168729902-c95bcc00-d2fa-4ce8-9095-ba130a6dc2b3.mp4