AnalysisFragmentCompat

public class AnalysisFragmentCompat extends Fragment implements FragmentImplCallback, AnalysisFragmentInterface
Component API

When you use the Component API with the Android Support Library, the 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 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 AnalyzeDocumentFragmentCompat into your layout by using the createInstance factory method to create an instance and display it using the androidx.fragment.app.FragmentManager.

An AnalysisFragmentListener instance must be available until the 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 setListener.

Your Activity is automatically set as the listener in onCreate.

Customizing the Analysis Screen

See the AnalysisActivity for details.

Functions

createInstance
Link copied to clipboard
static AnalysisFragmentCompat createInstance(@NonNull() Document document, @Nullable() String documentAnalysisErrorMessage)
Factory method for creating a new instance of the Fragment using the provided document.
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()
hideError
Link copied to clipboard
void hideError()
Call this method to hide the error shown before with showError or showError.
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, @Nullable() ViewGroup container, @Nullable() 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()
onDocumentAnalyzed
Link copied to clipboard
void onDocumentAnalyzed()
You should call this method after you've received the analysis results from the Gini API.
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)
onNoExtractionsFound
Link copied to clipboard
void onNoExtractionsFound()
You should call this method after you've received the analysis results from the Gini API without the required extractions.
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()
onSaveInstanceState
Link copied to clipboard
void onSaveInstanceState(Bundle outState)
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() AnalysisFragmentListener listener)
Set a listener for analysis 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)
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)
showError
Link copied to clipboard
void showError(@NonNull() String message, int duration)
Call this method when you need to show an error message to the user in the Analysis Screen.
void showError(@NonNull() String message, @NonNull() String buttonTitle, @NonNull() View.OnClickListener onClickListener)
Call this method when you need to show an error message with an invokable action to the user in the Analysis Screen.
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()
startScanAnimation
Link copied to clipboard
void startScanAnimation()
You should call this method when you start the document analysis using the Gini API.
stopScanAnimation
Link copied to clipboard
void stopScanAnimation()
You should call this method when the document analysis has finished.
toString
Link copied to clipboard
String toString()
unregisterForContextMenu
Link copied to clipboard
void unregisterForContextMenu(View view)