AnalysisFragmentCompat

Component API

When you use the Component API with the Android Support Library, the {@code * AnalyzeDocumentFragmentCompat} displays the captured or imported document and an activity indicator while the document is being analyzed by the Gini API.

Note: You can use the activity indicator message to display a message under the activity indicator by overriding the string resource named {@code gv_analysis_activity_indicator_message} . The message is displayed for images only.

For PDF documents the first page is shown (only on Android 5.0 Lollipop and newer) along with the PDF's filename and number of pages above the page. On Android KitKat and older only the PDF's filename is shown with the preview area left empty.

Note: Your Activity hosting this Fragment must extend the and use an AppCompat Theme.

Include the {@code AnalyzeDocumentFragmentCompat} into your layout by using the factory method to create an instance and display it using the androidx.fragment.app.FragmentManager .

An AnalysisFragmentListener instance must be available until the {@code * AnalysisFragmentCompat} 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 AnalysisFragmentListener interface or explicitly by setting the listener using .

Your Activity is automatically set as the listener in onCreate .

Customizing the Analysis Screen

See the AnalysisActivity for details.

public class AnalysisFragmentCompat extends Fragment implements FragmentImplCallback, AnalysisFragmentInterface

Functions

callStartTransitionListener
Link copied to clipboard
void callStartTransitionListener()
createFragmentImpl
Link copied to clipboard
AnalysisFragmentImpl createFragmentImpl()
createInstance
Link copied to clipboard

Factory method for creating a new instance of the Fragment using the provided document.

You may pass in an optional analysis error message. This error message is shown to the user with a retry button.

Note: Always use this method to create new instances. Document is required and an exception is thrown if it's missing.

dump
Link copied to clipboard
void dump(String prefix, FileDescriptor fd, PrintWriter writer, Array<Stringargs)
ensureAnimationInfo
Link copied to clipboard
Fragment.AnimationInfo ensureAnimationInfo()
equals
Link copied to clipboard
final boolean equals(Object o)
findFragmentByWho
Link copied to clipboard
Fragment findFragmentByWho(String who)
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()
getAnimatingAway
Link copied to clipboard
View getAnimatingAway()
getAnimator
Link copied to clipboard
Animator getAnimator()
getArguments
Link copied to clipboard
final Bundle getArguments()
getChildFragmentManager
Link copied to clipboard
final FragmentManager getChildFragmentManager()
getContext
Link copied to clipboard
Context getContext()
getDefaultViewModelProviderFactory
Link copied to clipboard
getEnterTransition
Link copied to clipboard
Object getEnterTransition()
getEnterTransitionCallback
Link copied to clipboard
SharedElementCallback getEnterTransitionCallback()
getExitTransition
Link copied to clipboard
Object getExitTransition()
getExitTransitionCallback
Link copied to clipboard
SharedElementCallback getExitTransitionCallback()
getFragmentImpl
Link copied to clipboard
AnalysisFragmentImpl getFragmentImpl()
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()
getNextAnim
Link copied to clipboard
int getNextAnim()
getNextTransition
Link copied to clipboard
int getNextTransition()
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()
getStateAfterAnimating
Link copied to clipboard
int getStateAfterAnimating()
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
LiveData<LifecycleOwnergetViewLifecycleOwnerLiveData()
getViewModelStore
Link copied to clipboard
ViewModelStore getViewModelStore()
hashCode
Link copied to clipboard
final int hashCode()
hasOptionsMenu
Link copied to clipboard
final boolean hasOptionsMenu()
hideError
Link copied to clipboard

Call this method to hide the error shown before with showError or showError .

void hideError()
initLifecycle
Link copied to clipboard
void initLifecycle()
initState
Link copied to clipboard
void initState()
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()
isHideReplaced
Link copied to clipboard
boolean isHideReplaced()
isInBackStack
Link copied to clipboard
final boolean isInBackStack()
isInLayout
Link copied to clipboard
final boolean isInLayout()
isMenuVisible
Link copied to clipboard
final boolean isMenuVisible()
isPostponed
Link copied to clipboard
boolean isPostponed()
isRemoving
Link copied to clipboard
final boolean isRemoving()
isRemovingParent
Link copied to clipboard
final boolean isRemovingParent()
isResumed
Link copied to clipboard
final boolean isResumed()
isStateSaved
Link copied to clipboard
final boolean isStateSaved()
isVisible
Link copied to clipboard
final boolean isVisible()
noteStateNotSaved
Link copied to clipboard
void noteStateNotSaved()
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.

void onCreate(Bundle savedInstanceState)
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
onCreateOptionsMenu
Link copied to clipboard
void onCreateOptionsMenu(Menu menu, MenuInflater inflater)
onCreateView
Link copied to clipboard
onDestroy
Link copied to clipboard
void onDestroy()

Internal use only.

void onDestroy()
onDestroyOptionsMenu
Link copied to clipboard
void onDestroyOptionsMenu()
onDestroyView
Link copied to clipboard
void onDestroyView()
onDetach
Link copied to clipboard
void onDetach()
onDocumentAnalyzed
Link copied to clipboard

You should call this method after you've received the analysis results from the Gini API.

void onDocumentAnalyzed()
onGetLayoutInflater
Link copied to clipboard
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)
onNoExtractionsFound
Link copied to clipboard

You should call this method after you've received the analysis results from the Gini API without the required extractions.

void onNoExtractionsFound()
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<Stringpermissions, Array<int> grantResults)
onResume
Link copied to clipboard
void onResume()
onSaveInstanceState
Link copied to clipboard
void onSaveInstanceState(Bundle outState)
onStart
Link copied to clipboard
void onStart()

Internal use only.

void onStart()
onStop
Link copied to clipboard
void onStop()

Internal use only.

void onStop()
onViewCreated
Link copied to clipboard
void onViewCreated(View view, Bundle savedInstanceState)
onViewStateRestored
Link copied to clipboard
void onViewStateRestored(Bundle savedInstanceState)
performActivityCreated
Link copied to clipboard
void performActivityCreated(Bundle savedInstanceState)
performAttach
Link copied to clipboard
void performAttach()
performConfigurationChanged
Link copied to clipboard
void performConfigurationChanged(Configuration newConfig)
performContextItemSelected
Link copied to clipboard
boolean performContextItemSelected(MenuItem item)
performCreate
Link copied to clipboard
void performCreate(Bundle savedInstanceState)
performCreateOptionsMenu
Link copied to clipboard
boolean performCreateOptionsMenu(Menu menu, MenuInflater inflater)
performCreateView
Link copied to clipboard
performDestroy
Link copied to clipboard
void performDestroy()
performDestroyView
Link copied to clipboard
void performDestroyView()
performDetach
Link copied to clipboard
void performDetach()
performGetLayoutInflater
Link copied to clipboard
performLowMemory
Link copied to clipboard
void performLowMemory()
performMultiWindowModeChanged
Link copied to clipboard
void performMultiWindowModeChanged(boolean isInMultiWindowMode)
performOptionsItemSelected
Link copied to clipboard
boolean performOptionsItemSelected(MenuItem item)
performOptionsMenuClosed
Link copied to clipboard
void performOptionsMenuClosed(Menu menu)
performPause
Link copied to clipboard
void performPause()
performPictureInPictureModeChanged
Link copied to clipboard
void performPictureInPictureModeChanged(boolean isInPictureInPictureMode)
performPrepareOptionsMenu
Link copied to clipboard
boolean performPrepareOptionsMenu(Menu menu)
performPrimaryNavigationFragmentChanged
Link copied to clipboard
void performPrimaryNavigationFragmentChanged()
performResume
Link copied to clipboard
void performResume()
performSaveInstanceState
Link copied to clipboard
void performSaveInstanceState(Bundle outState)
performStart
Link copied to clipboard
void performStart()
performStop
Link copied to clipboard
void performStop()
postponeEnterTransition
Link copied to clipboard
void postponeEnterTransition()
registerForContextMenu
Link copied to clipboard
void registerForContextMenu(View view)
requestPermissions
Link copied to clipboard
final void requestPermissions(Array<Stringpermissions, 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()
restoreChildFragmentState
Link copied to clipboard
void restoreChildFragmentState(Bundle savedInstanceState)
restoreViewState
Link copied to clipboard
final void restoreViewState(Bundle savedInstanceState)
setAllowEnterTransitionOverlap
Link copied to clipboard
void setAllowEnterTransitionOverlap(boolean allow)
setAllowReturnTransitionOverlap
Link copied to clipboard
void setAllowReturnTransitionOverlap(boolean allow)
setAnimatingAway
Link copied to clipboard
void setAnimatingAway(View view)
setAnimator
Link copied to clipboard
void setAnimator(Animator animator)
setArguments
Link copied to clipboard
void setArguments(Bundle args)
setEnterSharedElementCallback
Link copied to clipboard
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)
setHideReplaced
Link copied to clipboard
void setHideReplaced(boolean replaced)
setInitialSavedState
Link copied to clipboard
void setInitialSavedState(Fragment.SavedState state)
setListener
Link copied to clipboard

Set a listener for analysis events.

By default the hosting Activity is expected to implement the AnalysisFragmentListener . In case that is not feasible you may set the listener using this method.

Note: the listener is expected to be available until the fragment is attached to an activity. Make sure to set the listener before that.

void setListener(AnalysisFragmentListener listener)
setMenuVisibility
Link copied to clipboard
void setMenuVisibility(boolean menuVisible)
setNextAnim
Link copied to clipboard
void setNextAnim(int animResourceId)
setNextTransition
Link copied to clipboard
void setNextTransition(int nextTransition)
setOnStartEnterTransitionListener
Link copied to clipboard
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)
setStateAfterAnimating
Link copied to clipboard
void setStateAfterAnimating(int state)
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)
showError
Link copied to clipboard

Call this method when you need to show an error message to the user in the Analysis Screen.

void showError(String message, int duration)
abstract void showError(String message, int duration)

Call this method when you need to show an error message with an invokable action to the user in the Analysis Screen.

abstract void showError(String message, String buttonTitle, View.OnClickListener onClickListener)
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
startPostponedEnterTransition
Link copied to clipboard
void startPostponedEnterTransition()
startScanAnimation
Link copied to clipboard

You should call this method when you start the document analysis using the Gini API.

void startScanAnimation()
stopScanAnimation
Link copied to clipboard

You should call this method when the document analysis has finished.

void stopScanAnimation()
toString
Link copied to clipboard
String toString()
unregisterForContextMenu
Link copied to clipboard
void unregisterForContextMenu(View view)