-
-
Save deepak140596/75c3cfde8e5a1cecb3fa2244ef7a84d1 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
override fun onCreate(savedInstanceState: Bundle?) { | |
... | |
// Add this at the end of onCreate function | |
viewFinder = findViewById(R.id.view_finder) | |
// Request camera permissions | |
if (allPermissionsGranted()) { | |
viewFinder.post { startCamera() } | |
} else { | |
ActivityCompat.requestPermissions( | |
this, REQUIRED_PERMISSIONS, REQUEST_CODE_PERMISSIONS) | |
} | |
// Every time the provided texture view changes, recompute layout | |
viewFinder.addOnLayoutChangeListener { _, _, _, _, _, _, _, _, _ -> | |
updateTransform() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment