Closed ktran2017 closed 7 years ago
From generated file, Instacapture.class:
// // Source code recreated from a .class file by IntelliJ IDEA // (powered by Fernflower decompiler) //
package com.tarek360.instacapture;
import android.app.Activity; import android.graphics.Bitmap; import android.support.annotation.NonNull; import android.support.annotation.Nullable; import android.view.View; import com.tarek360.instacapture.ActivityReferenceManager; import com.tarek360.instacapture.exception.ActivityNotRunningException; import com.tarek360.instacapture.listener.ScreenCaptureListener; import com.tarek360.instacapture.screenshot.ScreenshotProvider; import com.tarek360.instacapture.utility.Logger; import rx.Observable; import rx.Subscriber; import rx.android.schedulers.AndroidSchedulers;
public class Instacapture { private static final String MESSAGE_IS_ACTIVITY_RUNNING = "Is your activity running?"; private static final String ERROR_SCREENSHOT_CAPTURE_FAILED = "Screenshot capture failed";
public Instacapture() {
}
public static void capture(@NonNull Activity activity, @NonNull final ScreenCaptureListener screenCaptureListener, @Nullable View... ignoredViews) {
screenCaptureListener.onCaptureStarted();
captureRx(activity, ignoredViews).subscribe(new Subscriber() {
public void onCompleted() {
}
public void onError(Throwable e) {
Logger.e("Screenshot capture failed");
Logger.printStackTrace(e);
screenCaptureListener.onCaptureFailed(e);
}
public void onNext(Bitmap bitmap) {
screenCaptureListener.onCaptureComplete(bitmap);
}
});
}
public static Observable<Bitmap> captureRx(@NonNull Activity activity, @Nullable View... ignoredViews) {
ActivityReferenceManager activityReferenceManager = new ActivityReferenceManager();
activityReferenceManager.setActivity(activity);
Activity validatedActivity = activityReferenceManager.getValidatedActivity();
if(validatedActivity == null) {
return Observable.error(new ActivityNotRunningException("Is your activity running?"));
} else {
ScreenshotProvider screenshotProvider = new ScreenshotProvider();
return screenshotProvider.getScreenshotBitmap(activity, ignoredViews).observeOn(AndroidSchedulers.mainThread());
}
}
public static void enableLogging(boolean enable) {
if(enable) {
Logger.enable();
} else {
Logger.disable();
}
}
}
thanks,i use compile "com.github.tarek360:instacapture:2.0.0-beta” intead of ''com.github.tarek360:instacapture:2.0.0-kotlin-beta1' ,now it run normal,but i find another problem ; when i use SurfaceView, when i screenshot ,the part of SurfaceView is dark.
i know this sdk support textureView。why i use SurfaceView ,because the app and ibotn of my company use 【Third party ‘Video call ’ of 'http://www.agora.io ',it need surfaceView 】
1 .I also know use android api i can screenshot normal for common compotent,but it does not work for SurfaceView.
Hi juyingguo,
Do you get the same issue with me on:
There is a difference between physical clone (download from instacapture:2.0.0-beta) and [compile "com.github.tarek360:instacapture:2.0.0-beta" ]
From [compile "com.github.tarek360:instacapture:2.0.0-beta”]
Missing "
public class Instacapture { private static final String MESSAGE_IS_ACTIVITY_RUNNING = "Is your activity running?"; private static final String ERROR_SCREENSHOT_CAPTURE_FAILED = "Screenshot capture failed";
public Instacapture() { }
public static void capture(@NonNull Activity activity, @NonNull final ScreenCaptureListener screenCaptureListener, @Nullable View... ignoredViews) {
screenCaptureListener.onCaptureStarted();
captureRx(activity, ignoredViews).subscribe(new Subscriber() { <<<<<<<< missing
public void onError(Throwable e) {
Logger.e("Screenshot capture failed");
Logger.printStackTrace(e);
screenCaptureListener.onCaptureFailed(e);
}
public void onNext(Bitmap bitmap) {
screenCaptureListener.onCaptureComplete(bitmap);
}
});
}
From physical clone from GitHub: public class Instacapture {
private static final String MESSAGE_IS_ACTIVITY_RUNNING = "Is your activity running?"; private static final String ERROR_SCREENSHOT_CAPTURE_FAILED = "Screenshot capture failed";
public static void capture(@NonNull Activity activity, @NonNull final ScreenCaptureListener screenCaptureListener, @Nullable View... ignoredViews) {
screenCaptureListener.onCaptureStarted();
captureRx(activity, ignoredViews).subscribe(**new Subscriber<Bitmap>()** { <<<<<< has <Bitmap> declaration <<<<<
@Override
public void onCompleted() {
}
@Override
public void onError(final Throwable e) {
Logger.e(ERROR_SCREENSHOT_CAPTURE_FAILED);
Logger.printStackTrace(e);
screenCaptureListener.onCaptureFailed(e);
}
@Override
public void onNext(final Bitmap bitmap) {
screenCaptureListener.onCaptureComplete(bitmap);
}
});
}
@juyingguo Instacapture doesn't support SurfaceView but support GLSurfaceView and TextureView. @ktran2017 I will check it.
ok,thanks
@ktran2017 I can't find any problem.
Hi there,
There is a difference between physical clone (download from instacapture:2.0.0-beta) and [compile "com.github.tarek360:instacapture:2.0.0-beta" ]
From compile "com.github.tarek360:instacapture:2.0.0-beta” Missing "Bitmap" for Subscriber
public class Instacapture { private static final String MESSAGE_IS_ACTIVITY_RUNNING = "Is your activity running?"; private static final String ERROR_SCREENSHOT_CAPTURE_FAILED = "Screenshot capture failed";
… }
From physical clone from GitHub: public class Instacapture {
… }
Is it intended or missing of Bitmap type?
Thanks so much, KT