Camera Fragment Compat
CameraFragmentCompat
is the main entry point to the Gini Vision Library when using the Component API with the Android Support Library.
It shows a camera preview with tap-to-focus functionality, a trigger button and an optional flash on/off button. The camera preview also shows document corner guides to which the user should align the document.
If instantiated with createInstance then a button for importing documents is shown next to the trigger button. A hint popup is displayed the first time the Gini Vision Library is used to inform the user about document importing.
For importing documents READ_EXTERNAL_STORAGE
permission is required and if the permission is not granted the Gini Vision Library will prompt the user to grant the permission. See @{code Customizing the Camera Screen} on how to override the message and button titles for the rationale and on permission denial alerts.
Note: Your Activity hosting this Fragment must extend the and use an AppCompat Theme.
Include the CameraFragmentCompat
into your layout either directly with <fragment>
in your Activity's layout or using the androidx.fragment.app.FragmentManager and one of the createInstance()
methods.
A CameraFragmentListener instance must be available until the
CameraFragmentCompat
is attached to an activity. Failing to do so will throw an exception. The listener instance can be provided either implicitly by making the hosting Activity implement the CameraFragmentListener interface or explicitly by setting the listener using setListener.
Your Activity is automatically set as the listener in onAttach.
Customizing the Camera ScreenSee the CameraActivity for details.