camera start and toggle async for no lag

pull/1/head
Dylan McIntyre 8 years ago
parent ac61100add
commit 21e058836e
  1. 17
      camerakit/src/main/java/com/flurgle/camerakit/CameraView.java

@ -149,7 +149,12 @@ public class CameraView extends FrameLayout {
public void start() {
int permissionCheck = ContextCompat.checkSelfPermission(getContext(), Manifest.permission.CAMERA);
if (permissionCheck == PackageManager.PERMISSION_GRANTED) {
mCameraImpl.start();
new Thread(new Runnable() {
@Override
public void run() {
mCameraImpl.start();
}
}).start();
} else {
requestCameraPermission();
}
@ -159,9 +164,15 @@ public class CameraView extends FrameLayout {
mCameraImpl.stop();
}
public void setFacing(@Facing int facing) {
public void setFacing(@Facing final int facing) {
this.mFacing = facing;
mCameraImpl.setFacing(facing);
new Thread(new Runnable() {
@Override
public void run() {
mCameraImpl.setFacing(facing);
}
}).start();
}
public void setFlash(@Flash int flash) {

Loading…
Cancel
Save