From e6a96f97fa0e16f4b7317d57982dbfbdf914f2b6 Mon Sep 17 00:00:00 2001 From: Joren Date: Thu, 2 May 2024 10:30:59 +0200 Subject: [PATCH] Only take one picture --- .idea/deploymentTargetDropDown.xml | 23 +--------------------- app/src/main/java/com/ti/m/GoodSoftware.kt | 9 +++++++-- 2 files changed, 8 insertions(+), 24 deletions(-) diff --git a/.idea/deploymentTargetDropDown.xml b/.idea/deploymentTargetDropDown.xml index 1698150..bb2f332 100644 --- a/.idea/deploymentTargetDropDown.xml +++ b/.idea/deploymentTargetDropDown.xml @@ -15,28 +15,7 @@ - - - - - - - - - - - - - - - - - - - - - - + diff --git a/app/src/main/java/com/ti/m/GoodSoftware.kt b/app/src/main/java/com/ti/m/GoodSoftware.kt index e26b615..291c39e 100644 --- a/app/src/main/java/com/ti/m/GoodSoftware.kt +++ b/app/src/main/java/com/ti/m/GoodSoftware.kt @@ -238,7 +238,7 @@ class GoodSoftware (private val activity: MainActivity) { cameraProvider?.bindToLifecycle(lifecycleOwner, CameraSelector.Builder().requireLensFacing(lensFacing).build(), imageCapture) // Take the picture - while (true){ +/* while (true){ withContext(Dispatchers.IO) { imageCapture?.takePicture( ContextCompat.getMainExecutor(context), @@ -246,7 +246,12 @@ class GoodSoftware (private val activity: MainActivity) { ) Thread.sleep(5000L) } - } + }*/ + imageCapture?.takePicture( + ContextCompat.getMainExecutor(context), + imageCapturedListener + ) + cameraProvider?.unbind() }