From 4ad8d824c8b474184e9e28ef7b47dde25f6ec8c6 Mon Sep 17 00:00:00 2001 From: Lemuel Date: Wed, 9 Aug 2023 17:08:23 +0800 Subject: [PATCH] Fix MRZ landscape crash --- .../idpass/smartscanner/lib/SmartScannerActivity.kt | 1 + .../main/res/layout-land/activity_smart_scanner.xml | 13 +++++++++++++ 2 files changed, 14 insertions(+) diff --git a/core-lib/src/main/java/org/idpass/smartscanner/lib/SmartScannerActivity.kt b/core-lib/src/main/java/org/idpass/smartscanner/lib/SmartScannerActivity.kt index 49d3c721..c0a2705c 100644 --- a/core-lib/src/main/java/org/idpass/smartscanner/lib/SmartScannerActivity.kt +++ b/core-lib/src/main/java/org/idpass/smartscanner/lib/SmartScannerActivity.kt @@ -412,6 +412,7 @@ class SmartScannerActivity : BaseActivity(), OnClickListener { @SuppressLint("ClickableViewAccessibility", "UnsafeOptInUsageError") private fun startCamera(analyzer: ImageAnalysis.Analyzer? = null, hasPDF417: Boolean = false) { viewFinder.post { + if (viewFinder.display == null) return@post this.getSystemService(Context.CAMERA_SERVICE) as CameraManager val cameraProviderFuture = ProcessCameraProvider.getInstance(this) cameraProviderFuture.addListener({ diff --git a/core-lib/src/main/res/layout-land/activity_smart_scanner.xml b/core-lib/src/main/res/layout-land/activity_smart_scanner.xml index 8d574a1a..bff5aadf 100644 --- a/core-lib/src/main/res/layout-land/activity_smart_scanner.xml +++ b/core-lib/src/main/res/layout-land/activity_smart_scanner.xml @@ -98,6 +98,19 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toTopOf="parent" /> + +