tarek360 / Instacapture

Android library to capture screenshot from your app
694 stars 113 forks source link

Rxjava2 conflict #25

Closed shuruncs closed 7 years ago

shuruncs commented 7 years ago

Could you please change Rx library to Rxjava2? My app's other library dependence conflict to you Rx1

tarek360 commented 7 years ago

That's very easy to fix

You can add the next few lines to your app/build.gradle at:

android { ... packagingOptions { exclude 'META-INF/rxjava.properties' } } reference: https://github.com/ReactiveX/RxJava/issues/4445

shuruncs commented 7 years ago

Thank you very much! It's works! But,when I tried to capture a surfaceView's image by using this: Instacapture.INSTANCE.capture(Play2Activity.this, new SimpleScreenCapturingListener() { @Override public void onCaptureComplete(Bitmap bitmap) {

                    String fileName = TimeUtil.getCurrDateTime() + ".png";
                    try {
                        FileUtil.savePictureToFile(bitmap, Parameters.SCREEN_SHOTS, fileName);
                    } catch (Exception e) {
                        e.printStackTrace();

                    }
                }
            }, layout_switch);

I cannot get the surfaceview's picture,the result was a empty picture.

tangxianqiang commented 7 years ago

Are you sure you can get Bitmap on SurfaceView by this lib? I can't get SurfaceView's bitmap on a game view(unity) .However,i got a bitmap whitch is under the SurfaceView.It looks like a penetrable bitmap .

shuruncs commented 7 years ago

I said i can not get Bitmap on SurfaceView by this lib.It works only on views!Finally ,i use MediaProjection to capture a surfaceView .我看了源码,发现这个库没法抓取SurfaceView,抓取surface必须用到MediaProjection

tangxianqiang commented 7 years ago

@shuruncs I'm agree with you.I just want to know how writer got the bitmap on surfaceView,he said this lib can work well with surfaceView or other openGL's view. By the way, MediaProjection also can't work well.If you want to get a bitmap by MediaProjection api, you need take somtime to init something.so there is about 0.1 second time out.

shuruncs commented 7 years ago

I think the writer just bragged!But there is no other way to capture surface except MediaProjection .I had searched everywhere .

tangxianqiang commented 7 years ago

@shuruncs Me too! Many programmer just publish article,they don't check their lib work well really.There are always four ways to get screen bitmap : normal view(mostly and the most foolish),by MediaProjection(need permission,has a dialog,time out),by reading framebuffer(need root and framebuffer file is different on different android device),and by ddms(need USB)! I'm going crazy.

tarek360 commented 7 years ago

@shuruncs @tangxianqiang No bragging here, please read the README file carefully.

Instacapture support GLSurfacView, Note, there is SurfaceView and there is GLSurfacView,

Instacapture can take a screenshot from GLSurfacView not from SurfaceView.

Also if you checked the sample app here, you will find an activity with a GLSurfacView.

Thanks.