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

Drawing not stopped when used in RecyclerView #15

Closed
rayanmestiri opened this issue Jun 28, 2016 · 5 comments
Closed

Drawing not stopped when used in RecyclerView #15

rayanmestiri opened this issue Jun 28, 2016 · 5 comments
Labels

Comments

@rayanmestiri
Copy link

I'm adding multiple BlurViews in a RecyclerView.
When I scroll to the point that a BlurView is outside the screen area and then scroll back to see that view, it crashes because the functions are called on null objects.

Maybe I can manage this outside the library, from the RecyclerView but how could I stop the draw calls on the BlurViews when they're not rendered and start them back when they are?

I tried adding conditions checks in the library but it does not start blurring back when the views are displayed again.

@Dimezis
Copy link
Owner

Dimezis commented Jun 28, 2016

Ok, I see. I'll check this behavior and add the possibility to correctly resume blurring.

@Dimezis Dimezis added the bug label Jun 30, 2016
@rayanmestiri
Copy link
Author

rayanmestiri commented Jun 30, 2016

Hi Dimezis,

Thanks for taking the time to look into this.
I wanted to point out that the errors returned by this bug are the same as this issue: #16
They are both related to showing/hiding the views but not by the same means.

I also wanted to point out that the bug also affects Fragments. When you commit a Fragment that replaces one that contains a BlurView, similar errors appear, due to the BlurView returned being null.

java.lang.NullPointerException: Attempt to invoke virtual method 'void android.view.View.invalidate()' on a null object reference at eightbitlab.com.blurview.DefaultBlurController.updateBlur(DefaultBlurController.java:138) at eightbitlab.com.blurview.DefaultBlurController.access$100(DefaultBlurController.java:21) at eightbitlab.com.blurview.DefaultBlurController$2.onPreDraw(DefaultBlurController.java:123)

Thanks for the great lib ^^

@Dimezis
Copy link
Owner

Dimezis commented Jun 30, 2016

Hi,

Yes, indeed it seems like they have the same root problem, more specifically - calling destroy() inside onDetachedFromWindow().

I have fixed the bug you reported (not released yet) and now investigating all possible consequences and related issues.

Thanks for help.

@Dimezis
Copy link
Owner

Dimezis commented Jun 30, 2016

Please check 1.1.0 version, I believe it should be fixed now.

@rayanmestiri
Copy link
Author

Ok, tested 1.1.0 on API 23 and it seems to be fixed now. It doesn't crash with RecyclerView, neither with a Fragment Manager. Thank you very much for fixing it so quickly, the lib is extremely useful.

I might do some GPU profiling at some point to make sure the blurring is stopped as intended in every cases. But I won't be able to do so just now.

Thanks again for the fix, I call the issue resolved.

@Dimezis Dimezis closed this as completed Jun 30, 2016
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