mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-01-30 15:04:49 +01:00
toggle Camera availability when appropriate
This commit is contained in:
parent
c521b33ed9
commit
209700dc72
@ -239,18 +239,21 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
||||
mCameraOpenCloseLock.release()
|
||||
mCameraDevice = cameraDevice
|
||||
createCameraPreviewSession()
|
||||
mActivity.setIsCameraAvailable(true)
|
||||
}
|
||||
|
||||
override fun onDisconnected(cameraDevice: CameraDevice) {
|
||||
mCameraOpenCloseLock.release()
|
||||
cameraDevice.close()
|
||||
mCameraDevice = null
|
||||
mActivity.setIsCameraAvailable(false)
|
||||
}
|
||||
|
||||
override fun onError(cameraDevice: CameraDevice, error: Int) {
|
||||
mCameraOpenCloseLock.release()
|
||||
cameraDevice.close()
|
||||
mCameraDevice = null
|
||||
mActivity.setIsCameraAvailable(false)
|
||||
}
|
||||
}
|
||||
|
||||
@ -456,9 +459,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
||||
override fun deviceOrientationChanged() {
|
||||
}
|
||||
|
||||
override fun resumeCamera(): Boolean {
|
||||
return false
|
||||
}
|
||||
override fun resumeCamera() = true
|
||||
|
||||
override fun onLayout(changed: Boolean, l: Int, t: Int, r: Int, b: Int) {}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user