CameraFragmentCompat

public class CameraFragmentCompat extends Fragment implements CameraFragmentInterface, FragmentImplCallback
Component API

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 Screen

See the CameraActivity for details.

Functions

createInstance
Link copied to clipboard
static CameraFragmentCompat createInstance()
static CameraFragmentCompat createInstance(@NonNull() GiniVisionFeatureConfiguration giniVisionFeatureConfiguration)
Factory method for creating a new instance of the Fragment with document import enabled for the specified file types.
dump
Link copied to clipboard
void dump(String prefix, FileDescriptor fd, PrintWriter writer, Array<String> args)
equals
Link copied to clipboard
final boolean equals(Object o)
getActivity
Link copied to clipboard
final FragmentActivity getActivity()
abstract Activity getActivity()
getAllowEnterTransitionOverlap
Link copied to clipboard
boolean getAllowEnterTransitionOverlap()
getAllowReturnTransitionOverlap
Link copied to clipboard
boolean getAllowReturnTransitionOverlap()
getArguments
Link copied to clipboard
final Bundle getArguments()
getChildFragmentManager
Link copied to clipboard
final FragmentManager getChildFragmentManager()
getContext
Link copied to clipboard
Context getContext()
getEnterTransition
Link copied to clipboard
Object getEnterTransition()
getExitTransition
Link copied to clipboard
Object getExitTransition()
getFragmentManager
Link copied to clipboard
final FragmentManager getFragmentManager()
getHost
Link copied to clipboard
final Object getHost()
getId
Link copied to clipboard
final int getId()
getLayoutInflater
Link copied to clipboard
final LayoutInflater getLayoutInflater()
getLifecycle
Link copied to clipboard
Lifecycle getLifecycle()
getLoaderManager
Link copied to clipboard
LoaderManager getLoaderManager()
getParentFragment
Link copied to clipboard
final Fragment getParentFragment()
getParentFragmentManager
Link copied to clipboard
final FragmentManager getParentFragmentManager()
getReenterTransition
Link copied to clipboard
Object getReenterTransition()
getResources
Link copied to clipboard
final Resources getResources()
getRetainInstance
Link copied to clipboard
final boolean getRetainInstance()
getReturnTransition
Link copied to clipboard
Object getReturnTransition()
getSavedStateRegistry
Link copied to clipboard
final SavedStateRegistry getSavedStateRegistry()
getSharedElementEnterTransition
Link copied to clipboard
Object getSharedElementEnterTransition()
getSharedElementReturnTransition
Link copied to clipboard
Object getSharedElementReturnTransition()
getString
Link copied to clipboard
final String getString(int resId)
getTag
Link copied to clipboard
final String getTag()
getTargetFragment
Link copied to clipboard
final Fragment getTargetFragment()
getTargetRequestCode
Link copied to clipboard
final int getTargetRequestCode()
getText
Link copied to clipboard
final CharSequence getText(int resId)
getUserVisibleHint
Link copied to clipboard
boolean getUserVisibleHint()
getView
Link copied to clipboard
View getView()
abstract View getView()
getViewLifecycleOwner
Link copied to clipboard
LifecycleOwner getViewLifecycleOwner()
getViewLifecycleOwnerLiveData
Link copied to clipboard
getViewModelStore
Link copied to clipboard
ViewModelStore getViewModelStore()
hashCode
Link copied to clipboard
final int hashCode()
hasOptionsMenu
Link copied to clipboard
final boolean hasOptionsMenu()
void hideActivityIndicatorAndEnableInteraction()
Call this method to hide the activity indicator and enable user interaction.
hideCameraTriggerButton
Link copied to clipboard
void hideCameraTriggerButton()
Call this method to hide the camera trigger button.
hideDocumentCornerGuides
Link copied to clipboard
void hideDocumentCornerGuides()
Call this method to hide the document corner guides.
hideInterface
Link copied to clipboard
void hideInterface()
Call this method to hide the interface elements.
instantiate
Link copied to clipboard
static Fragment instantiate(Context context, String fname)
isAdded
Link copied to clipboard
final boolean isAdded()
isDetached
Link copied to clipboard
final boolean isDetached()
isHidden
Link copied to clipboard
final boolean isHidden()
isInLayout
Link copied to clipboard
final boolean isInLayout()
isMenuVisible
Link copied to clipboard
final boolean isMenuVisible()
isRemoving
Link copied to clipboard
final boolean isRemoving()
isResumed
Link copied to clipboard
final boolean isResumed()
isStateSaved
Link copied to clipboard
final boolean isStateSaved()
isVisible
Link copied to clipboard
final boolean isVisible()
onActivityCreated
Link copied to clipboard
void onActivityCreated(Bundle savedInstanceState)
onActivityResult
Link copied to clipboard
void onActivityResult(int requestCode, int resultCode, Intent data)
onAttach
Link copied to clipboard
void onAttach(Context context)
onAttachFragment
Link copied to clipboard
void onAttachFragment(Fragment childFragment)
onConfigurationChanged
Link copied to clipboard
void onConfigurationChanged(Configuration newConfig)
onContextItemSelected
Link copied to clipboard
boolean onContextItemSelected(MenuItem item)
onCreate
Link copied to clipboard
void onCreate(Bundle savedInstanceState)
Internal use only.
onCreateAnimation
Link copied to clipboard
Animation onCreateAnimation(int transit, boolean enter, int nextAnim)
onCreateAnimator
Link copied to clipboard
Animator onCreateAnimator(int transit, boolean enter, int nextAnim)
onCreateContextMenu
Link copied to clipboard
void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo)
onCreateOptionsMenu
Link copied to clipboard
void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
onCreateView
Link copied to clipboard
View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
Internal use only.
onDestroy
Link copied to clipboard
void onDestroy()
Internal use only.
onDestroyOptionsMenu
Link copied to clipboard
void onDestroyOptionsMenu()
onDestroyView
Link copied to clipboard
void onDestroyView()
onDetach
Link copied to clipboard
void onDetach()
onGetLayoutInflater
Link copied to clipboard
LayoutInflater onGetLayoutInflater(Bundle savedInstanceState)
onHiddenChanged
Link copied to clipboard
void onHiddenChanged(boolean hidden)
onInflate
Link copied to clipboard
void onInflate(Context context, AttributeSet attrs, Bundle savedInstanceState)
onLowMemory
Link copied to clipboard
void onLowMemory()
onMultiWindowModeChanged
Link copied to clipboard
void onMultiWindowModeChanged(boolean isInMultiWindowMode)
onOptionsItemSelected
Link copied to clipboard
boolean onOptionsItemSelected(MenuItem item)
onOptionsMenuClosed
Link copied to clipboard
void onOptionsMenuClosed(Menu menu)
onPause
Link copied to clipboard
void onPause()
onPictureInPictureModeChanged
Link copied to clipboard
void onPictureInPictureModeChanged(boolean isInPictureInPictureMode)
onPrepareOptionsMenu
Link copied to clipboard
void onPrepareOptionsMenu(Menu menu)
onPrimaryNavigationFragmentChanged
Link copied to clipboard
void onPrimaryNavigationFragmentChanged(boolean isPrimaryNavigationFragment)
onRequestPermissionsResult
Link copied to clipboard
void onRequestPermissionsResult(int requestCode, Array<String> permissions, Array<int> grantResults)
onResume
Link copied to clipboard
void onResume()
Internal use only.
onSaveInstanceState
Link copied to clipboard
void onSaveInstanceState(@NonNull() Bundle outState)
Internal use only.
onStart
Link copied to clipboard
void onStart()
Internal use only.
onStop
Link copied to clipboard
void onStop()
Internal use only.
onViewCreated
Link copied to clipboard
void onViewCreated(View view, Bundle savedInstanceState)
onViewStateRestored
Link copied to clipboard
void onViewStateRestored(Bundle savedInstanceState)
postponeEnterTransition
Link copied to clipboard
void postponeEnterTransition()
registerForActivityResult
Link copied to clipboard
final ActivityResultLauncher<IregisterForActivityResult<I, O>(ActivityResultContract<I, O> contract, ActivityResultCallback<O> callback)
registerForContextMenu
Link copied to clipboard
void registerForContextMenu(View view)
requestPermissions
Link copied to clipboard
final void requestPermissions(Array<String> permissions, int requestCode)
requireActivity
Link copied to clipboard
final FragmentActivity requireActivity()
requireArguments
Link copied to clipboard
final Bundle requireArguments()
requireContext
Link copied to clipboard
final Context requireContext()
requireFragmentManager
Link copied to clipboard
final FragmentManager requireFragmentManager()
requireHost
Link copied to clipboard
final Object requireHost()
requireParentFragment
Link copied to clipboard
final Fragment requireParentFragment()
requireView
Link copied to clipboard
final View requireView()
setAllowEnterTransitionOverlap
Link copied to clipboard
void setAllowEnterTransitionOverlap(boolean allow)
setAllowReturnTransitionOverlap
Link copied to clipboard
void setAllowReturnTransitionOverlap(boolean allow)
setArguments
Link copied to clipboard
void setArguments(Bundle args)
setEnterSharedElementCallback
Link copied to clipboard
void setEnterSharedElementCallback(SharedElementCallback callback)
setEnterTransition
Link copied to clipboard
void setEnterTransition(Object transition)
setExitSharedElementCallback
Link copied to clipboard
void setExitSharedElementCallback(SharedElementCallback callback)
setExitTransition
Link copied to clipboard
void setExitTransition(Object transition)
setHasOptionsMenu
Link copied to clipboard
void setHasOptionsMenu(boolean hasMenu)
setInitialSavedState
Link copied to clipboard
void setInitialSavedState(Fragment.SavedState state)
setListener
Link copied to clipboard
void setListener(@NonNull() CameraFragmentListener listener)
Set a listener for camera events.
setMenuVisibility
Link copied to clipboard
void setMenuVisibility(boolean menuVisible)
setReenterTransition
Link copied to clipboard
void setReenterTransition(Object transition)
setRetainInstance
Link copied to clipboard
void setRetainInstance(boolean retain)
setReturnTransition
Link copied to clipboard
void setReturnTransition(Object transition)
setSharedElementEnterTransition
Link copied to clipboard
void setSharedElementEnterTransition(Object transition)
setSharedElementReturnTransition
Link copied to clipboard
void setSharedElementReturnTransition(Object transition)
setTargetFragment
Link copied to clipboard
void setTargetFragment(Fragment fragment, int requestCode)
setUserVisibleHint
Link copied to clipboard
void setUserVisibleHint(boolean isVisibleToUser)
shouldShowRequestPermissionRationale
Link copied to clipboard
boolean shouldShowRequestPermissionRationale(String permission)
void showActivityIndicatorAndDisableInteraction()
Call this method to show an activity indicator and disable user interaction.
showAlertDialog
Link copied to clipboard
void showAlertDialog(@NonNull() String message, @NonNull() String positiveButtonTitle, @NonNull() DialogInterface.OnClickListener positiveButtonClickListener, @Nullable() String negativeButtonTitle, @Nullable() DialogInterface.OnClickListener negativeButtonClickListener, @Nullable() DialogInterface.OnCancelListener cancelListener)
showCameraTriggerButton
Link copied to clipboard
void showCameraTriggerButton()
Call this method to show the camera trigger button.
showDocumentCornerGuides
Link copied to clipboard
void showDocumentCornerGuides()
Call this method to show the document corner guides.
showError
Link copied to clipboard
void showError(@NonNull() String message, int duration)
Call this method to show an error message to the user in the Camera Screen.
showInterface
Link copied to clipboard
void showInterface()
Call this method to show the interface elements.
startActivity
Link copied to clipboard
void startActivity(Intent intent)
abstract void startActivity(Intent intent)
startActivityForResult
Link copied to clipboard
void startActivityForResult(Intent intent, int requestCode)
abstract void startActivityForResult(Intent intent, int requestCode)
startIntentSenderForResult
Link copied to clipboard
void startIntentSenderForResult(IntentSender intent, int requestCode, Intent fillInIntent, int flagsMask, int flagsValues, int extraFlags, Bundle options)
startPostponedEnterTransition
Link copied to clipboard
void startPostponedEnterTransition()
toString
Link copied to clipboard
String toString()
unregisterForContextMenu
Link copied to clipboard
void unregisterForContextMenu(View view)