clearing latest result on camera start; handling unsupported types and showing error in text
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user