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

Cannot use blur view with RecyclerView #8

Open
ghost opened this issue Jun 22, 2015 · 2 comments
Open

Cannot use blur view with RecyclerView #8

ghost opened this issue Jun 22, 2015 · 2 comments

Comments

@ghost
Copy link

ghost commented Jun 22, 2015

Hello,

I was trying to use your blur view in my app insde items displyed in RecyclerView. Unfortunatly, after my recycler is scrolled (up or down) for few items I get following exception:

android.support.v8.renderscript.RSInvalidStateException: Calling RS with no Context active.
at android.support.v8.renderscript.ExceptionThunker.convertException(ExceptionThunker.java:26)
at android.support.v8.renderscript.AllocationThunker.copyFrom(AllocationThunker.java:183)

It is thrown from blur method. To me it looks like this is caused by items being recycled and reused by RecycleView. For current moment I haven't found any solution for this.

@sbelloz
Copy link

sbelloz commented Jun 23, 2015

same with HeaderGridView. My blurred view is the header of my GridView. When I call setAdapter multiple times it crashes. My workaround is to comment these lines of code:

//     @Override
//     protected void onDetachedFromWindow() {
//         super.onDetachedFromWindow();
//        if (mRenderScript != null) {
//            mRenderScript.destroy();
//        }
//     }

but I think is not a good practice.

@jaadchacra
Copy link

I used it normally...
public ViewHolder(View itemView) { super(itemView); imageView = (ImageView) itemView.findViewById(R.id.imageViewHero); mBlurringView = (BlurringView) itemView.findViewById(R.id.blurring_view); View blurredView = itemView.findViewById(R.id.imageViewHero); mBlurringView.setBlurredView(blurredView);

`

            <com.fivehundredpx.android.blur.BlurringView
                android:id="@+id/blurring_view"
                android:layout_width="match_parent"
                android:layout_height="250dp"
                android:layout_gravity="center"
                app:blurRadius="11"
                app:downsampleFactor="6"
                app:overlayColor="#99FFFFFF"/>`

Just make sure that your BlurringView isn't the child of the BlurredView as you can see above

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

No branches or pull requests

2 participants