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