make sure the aspect ratio is always updated on the main thread

This commit is contained in:
tibbi
2018-06-10 21:18:28 +02:00
parent 5f0a1d0475
commit d533b18a91

View File

@ -351,7 +351,9 @@ class PreviewCameraTwo : ViewGroup, TextureView.SurfaceTextureListener, MyPrevie
val outputSizes = if (mIsInVideoMode) configMap.getOutputSizes(MediaRecorder::class.java) else configMap.getOutputSizes(SurfaceTexture::class.java)
mPreviewSize = chooseOptimalPreviewSize(outputSizes, rotatedPreviewWidth, rotatedPreviewHeight, maxPreviewWidth, maxPreviewHeight, currentResolution)
mActivity.runOnUiThread {
mTextureView.setAspectRatio(mPreviewSize!!.height, mPreviewSize!!.width)
}
characteristics.apply {
mIsFlashSupported = get(CameraCharacteristics.FLASH_INFO_AVAILABLE) ?: false
mIsZoomSupported = get(CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM) ?: 0f > 0f