mirror of
https://github.com/SimpleMobileTools/Simple-Camera.git
synced 2025-02-16 19:30:40 +01:00
show some exception messages publicly to speed up the glitch fixes
This commit is contained in:
parent
335529ccbb
commit
c6dfeb97b7
@ -121,6 +121,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
|||||||
val cameraCharacteristics = try {
|
val cameraCharacteristics = try {
|
||||||
getCameraCharacteristics(activity.config.lastUsedCamera)
|
getCameraCharacteristics(activity.config.lastUsedCamera)
|
||||||
} catch (e: IllegalArgumentException) {
|
} catch (e: IllegalArgumentException) {
|
||||||
|
mActivity.showErrorToast("Get camera characteristics $e")
|
||||||
null
|
null
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -209,12 +210,15 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
|||||||
@SuppressLint("MissingPermission")
|
@SuppressLint("MissingPermission")
|
||||||
private fun openCamera(width: Int, height: Int) {
|
private fun openCamera(width: Int, height: Int) {
|
||||||
try {
|
try {
|
||||||
setupCameraOutputs(width, height)
|
mActivity.runOnUiThread {
|
||||||
if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
|
setupCameraOutputs(width, height)
|
||||||
throw RuntimeException("Time out waiting to lock camera opening.")
|
if (!mCameraOpenCloseLock.tryAcquire(2500, TimeUnit.MILLISECONDS)) {
|
||||||
|
throw RuntimeException("Time out waiting to lock camera opening.")
|
||||||
|
}
|
||||||
|
getCameraManager().openCamera(mCameraId, cameraStateCallback, mBackgroundHandler)
|
||||||
}
|
}
|
||||||
getCameraManager().openCamera(mCameraId, cameraStateCallback, mBackgroundHandler)
|
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
mActivity.showErrorToast("Open camera $e")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -378,6 +382,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
mActivity.showErrorToast("Setup camera outputs $e")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -481,6 +486,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
|||||||
mCameraDevice!!.createCaptureSession(Arrays.asList(surface, mImageReader!!.surface), stateCallback, null)
|
mCameraDevice!!.createCaptureSession(Arrays.asList(surface, mImageReader!!.surface), stateCallback, null)
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
mActivity.showErrorToast("Create preview $e")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,6 +592,7 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
|
|||||||
capture(captureBuilder.build(), captureCallback, null)
|
capture(captureBuilder.build(), captureCallback, null)
|
||||||
}
|
}
|
||||||
} catch (e: CameraAccessException) {
|
} catch (e: CameraAccessException) {
|
||||||
|
mActivity.showErrorToast("Capture picture $e")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user