Created
August 15, 2020 10:48
-
-
Save dcampogiani/4815bb1cc7800c401a41f40ac827bb8c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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