clearing latest result on camera start; handling unsupported types and showing error in text

This commit is contained in:
2024-04-02 22:19:40 +03:00
parent 7d72285cec
commit c35612e63a
@@ -109,6 +109,7 @@ class MainActivity : ComponentActivity() {
).show() ).show()
} else { } else {
cameraEnabled = true cameraEnabled = true
latestResult = null
} }
}, },
modifier = Modifier.weight(1f) modifier = Modifier.weight(1f)
@@ -199,10 +200,17 @@ class MainActivity : ComponentActivity() {
} }
else -> { else -> {
val unsupportedTypeText = "Unsupported type: $type; result: ${barcode.rawValue}"
Log.e( Log.e(
"StartCamera", "StartCamera",
"StartCamera: unsupported type: $type; result: ${barcode.rawValue}" "StartCamera: unsupported type: $type; result: ${barcode.rawValue}"
) )
cameraProvider?.unbindAll()
cameraProvider = null
onResult(unsupportedTypeText)
} }
} }