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

App is crashing when using Filter effects in recycler view #242

Open
zohaib1sahni opened this issue May 9, 2020 · 6 comments
Open

App is crashing when using Filter effects in recycler view #242

zohaib1sahni opened this issue May 9, 2020 · 6 comments

Comments

@zohaib1sahni
Copy link

I'm using an image from device storage and applying 24 filters of this library to the every position of recycler view.
I want to show every filter effect in recycler view with user image. But app is crashing..

E/AndroidRuntime: FATAL EXCEPTION: GLThread 27601
Process: com.xzama.tattoophotoeditorpro, PID: 1775
java.lang.RuntimeException: glUseProgram: glError 1281
at ja.burhanrashid52.photoeditor.GLToolbox.checkGlError(GLToolbox.java:71)
at ja.burhanrashid52.photoeditor.TextureRenderer.renderTexture(TextureRenderer.java:111)
at ja.burhanrashid52.photoeditor.ImageFilterView.renderResult(ImageFilterView.java:272)
at ja.burhanrashid52.photoeditor.ImageFilterView.onDrawFrame(ImageFilterView.java:102)
at android.opengl.GLSurfaceView$GLThread.guardedRun(GLSurfaceView.java:1562)
at android.opengl.GLSurfaceView$GLThread.run(GLSurfaceView.java:1262)

@burhanrashid52
Copy link
Owner

burhanrashid52 commented May 12, 2020

Yes, This is a known issue #48 . Currently not able to identify the fix. Happy to see a PR on this.

mohammad-fattah added a commit to mohammad-fattah/PhotoEditor that referenced this issue Jun 26, 2020
@OnwukaDaniel
Copy link

I am facing the same issue rn.
Any hack for it till a fix comes visiting?

@OnwukaDaniel
Copy link

I found a solution.
Wrap as much filter-views you want in a LinearLayout and wrap the Linear layout in a HorizontalScrollView .
Then in Code set the filter to each view. (It's pretty a manual way, but it works)
`

    <LinearLayout
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:orientation="horizontal">

        <ja.burhanrashid52.photoeditor.PhotoEditorView
            android:id="@+id/filter1"
            android:layout_width="100dp"
            android:layout_height="140dp"
            app:photo_src="@drawable/filter_image1"
            android:layout_marginHorizontal="4dp" />

        <ja.burhanrashid52.photoeditor.PhotoEditorView
            android:id="@+id/filter2"
            android:layout_width="100dp"
            android:layout_height="140dp"
            app:photo_src="@drawable/filter_image1"
            android:layout_marginHorizontal="4dp" />

        <ja.burhanrashid52.photoeditor.PhotoEditorView
            android:id="@+id/filter3"
            android:layout_width="100dp"
            android:layout_height="140dp"
            app:photo_src="@drawable/filter_image1"
            android:layout_marginHorizontal="4dp" />

        <ja.burhanrashid52.photoeditor.PhotoEditorView
            android:id="@+id/filter4"
            android:layout_width="100dp"
            app:photo_src="@drawable/filter_image1"
            android:layout_height="140dp"
            android:layout_marginHorizontal="4dp" />

        <ja.burhanrashid52.photoeditor.PhotoEditorView
            android:id="@+id/filter5"
            android:layout_width="100dp"
            app:photo_src="@drawable/filter_image1"
            android:layout_height="140dp"
            android:layout_marginHorizontal="4dp" />

        <ja.burhanrashid52.photoeditor.PhotoEditorView
            android:id="@+id/filter6"
            android:layout_width="100dp"
            android:layout_height="140dp"
            app:photo_src="@drawable/filter_image1"
            android:layout_marginHorizontal="4dp" />

        <ja.burhanrashid52.photoeditor.PhotoEditorView
            android:id="@+id/filter7"
            android:layout_width="100dp"
            android:layout_height="140dp"
            app:photo_src="@drawable/filter_image1"
            android:layout_marginHorizontal="4dp" />

    </LinearLayout>

</HorizontalScrollView>`

@burhanrashid52
Copy link
Owner

Wrap as much filter-views you want in a LinearLayout and wrap the Linear layout in a HorizontalScrollView .

It's good that it works for you, but be cautious because this has some performance penalty on scroll compared to RecycleView, because LinearLayout render all views regardless it's visible to the screen or not.

@OnwukaDaniel
Copy link

Wrap as much filter-views you want in a LinearLayout and wrap the Linear layout in a HorizontalScrollView .

It's good that it works for you, but be cautious because this has some performance penalty on scroll compared to RecycleView, because LinearLayout render all views regardless it's visible to the screen or not.

Yes. The libary has issue when views are recycled and effects are reapplied. This is the known issue.
That is why in this case, instead of loading the real images, a dummy image of low quality is used in the Horizontal scroll view.
Loading all filtered-dummy images (not more than 20 filter) won't cause performance issues). Esp when once loaded it doesn't need to reload.

But it got me thinking, how the sample gif in the libary's readme was made. Was it a previous version?

@burhanrashid52
Copy link
Owner

But it got me thinking, how the sample gif in the libary's readme was made. Was it a previous version?

Which gif are you talking about?

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

No branches or pull requests

3 participants