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

NullPointerException on a BlurView previously shown #16

Closed
ricardomello opened this issue Jun 29, 2016 · 5 comments
Closed

NullPointerException on a BlurView previously shown #16

ricardomello opened this issue Jun 29, 2016 · 5 comments
Labels

Comments

@ricardomello
Copy link

I'm having trouble hiding and showing a BlurView, I have a grid with a few tiles, when a button is pressed the blur appears and then the user can hide it. When I show it for the first time or multiple times on the same tile it works properly but when I show it on another tile and go back to the first one I get an exception. The BlurView is inside a RelativeLayout and I'm using alpha + visibility to show/hide the layout (but it also happens if the Blur is outside this layout).

My code is:

final float radius = 8;
final View rootView = itemView.getRootView();

overlay.setupWith(rootView)
       .blurAlgorithm(new RenderScriptBlur(itemView.getContext(), true))
       .blurRadius(radius);
overlay.stopAutoBlurUpdate();

This is the exception:

java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getLeft()' on a null object reference
at eightbitlab.com.blurview.DefaultBlurController.setupInternalCanvasMatrix(DefaultBlurController.java:181)
at eightbitlab.com.blurview.DefaultBlurController.drawBlurredContent(DefaultBlurController.java:212)
at eightbitlab.com.blurview.BlurView.draw(BlurView.java:57)
at android.view.View.updateDisplayListIfDirty(View.java:15190)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.draw(View.java:16197)
at android.view.View.updateDisplayListIfDirty(View.java:15190)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.support.v7.widget.RecyclerView.drawChild(RecyclerView.java:4134)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.draw(View.java:16197)
at android.support.v7.widget.RecyclerView.draw(RecyclerView.java:3543)
at android.view.View.updateDisplayListIfDirty(View.java:15190)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.support.design.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1131)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.support.v4.widget.DrawerLayout.drawChild(DrawerLayout.java:1377)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.draw(View.java:16197)
at android.view.View.updateDisplayListIfDirty(View.java:15190)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.updateDisplayListIfDirty(View.java:15185)
at android.view.View.draw(View.java:15964)
at android.view.ViewGroup.drawChild(ViewGroup.java:3612)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:3402)
at android.view.View.draw(View.java:16197)
at com.android.internal.policy.PhoneWindow$DecorView.draw(PhoneWindow.java:2690)
at android.view.View.updateDisplayListIfDirty(View.java:15190)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:281)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:287)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:322)

Thanks in advance.

@Dimezis
Copy link
Owner

Dimezis commented Jun 30, 2016

Thank you, I'll fix it soon.

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

Dimezis commented Jun 30, 2016

Can you please clarify, the grid you mentioned is ListView / GridView / RecyclerView?

If it's not, do you call removeView(View) to remove the BlurView?

@ricardomello
Copy link
Author

The grid is a RecyclerView with a GridLayoutManager. I don't exactly remove the view, I merely hide it by animating the alpha of the RelativeLayout (that has the BlurView inside) to 0 and then setting the layout's visibility to gone.

@Dimezis
Copy link
Owner

Dimezis commented Jun 30, 2016

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

@ricardomello
Copy link
Author

It was fixed indeed, thanks!

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