Skip to content

Instantly share code, notes, and snippets.

@dcampogiani
Created August 15, 2020 10:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dcampogiani/4815bb1cc7800c401a41f40ac827bb8c to your computer and use it in GitHub Desktop.
Save dcampogiani/4815bb1cc7800c401a41f40ac827bb8c to your computer and use it in GitHub Desktop.
private fun bindUseCases(cameraProvider: ProcessCameraProvider) {
val preview = buildPreview()
val takePicture = buildTakePicture()
val cameraSelector = buildCameraSelector()
cameraProvider.bindToLifecycle(this, cameraSelector, preview, takePicture)
button.setOnClickListener {
lifecycle.coroutineScope.launchWhenResumed {
val imageProxy = takePicture.takePicture(executor)
val cardDetails = useCase(imageProxy.image!!, imageProxy.imageInfo.rotationDegrees)
bindCardDetails(cardDetails)
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment