Package 

Class ReviewActivity

  • All Implemented Interfaces:
    android.content.ComponentCallbacks , android.content.ComponentCallbacks2 , android.view.KeyEvent.Callback , android.view.LayoutInflater.Factory , android.view.LayoutInflater.Factory2 , android.view.View.OnCreateContextMenuListener , android.view.Window.Callback , androidx.activity.OnBackPressedDispatcherOwner , androidx.activity.contextaware.ContextAware , androidx.activity.result.ActivityResultCaller , androidx.activity.result.ActivityResultRegistryOwner , androidx.appcompat.app.ActionBarDrawerToggle.DelegateProvider , androidx.appcompat.app.AppCompatCallback , androidx.core.app.ActivityCompat.OnRequestPermissionsResultCallback , androidx.core.app.ActivityCompat.RequestPermissionsRequestCodeValidator , androidx.core.app.TaskStackBuilder.SupportParentable , androidx.core.view.KeyEventDispatcher.Component , androidx.lifecycle.HasDefaultViewModelProviderFactory , androidx.lifecycle.LifecycleOwner , androidx.lifecycle.ViewModelStoreOwner , androidx.savedstate.SavedStateRegistryOwner , net.gini.android.capture.review.ReviewFragmentInterface , net.gini.android.capture.review.ReviewFragmentListener

    
    public class ReviewActivity
    extends AppCompatActivity implements ReviewFragmentListener, ReviewFragmentInterface
                        
    Screen API When you use the Screen API, the ReviewActivity displays the photographed or imported image and allows the user to review it by checking the sharpness, quality and orientation of the image. The user can correct the orientation by rotating the image.

    The preferred way of adding network calls to the Gini Capture SDK is by creating a GiniCapture instance with a GiniCaptureNetworkService and a GiniCaptureNetworkApi implementation.

    The ReviewActivity is started by the CameraActivity after the user has taken a photo or imported an image of a document.

    Customizing the Review Screen Customizing the look of the Review Screen is done via overriding of app resources.

    The following items are customizable:

    • Rotate button icon: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named gc_review_button_rotate.png
    • Rotate button color: via the color resources named gc_review_fab_mini and gc_review_fab_mini_pressed
    • Next button icon: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named gc_review_fab_next.png
    • Next button color: via the color resources named gc_review_fab and gc_review_fab_pressed
    • Bottom advice text: via the string resource named gc_review_bottom_panel_text
    • Bottom text color: via the color resource named gc_review_bottom_panel_text
    • Bottom text font: via overriding the style named GiniCaptureTheme.Review.BottomPanel.TextStyle and setting an item named gcCustomFont with the path to the font file in your assets folder
    • Bottom text style: via overriding the style named GiniCaptureTheme.Review.BottomPanel.TextStyle and setting an item named android:textStyle to normal, bold or italic
    • Bottom text size: via overriding the style named GiniCaptureTheme.Review.BottomPanel.TextStyle and setting an item named android:textSize to the desired sp size
    • Bottom panel background color: via the color resource named gc_review_bottom_panel_background
    • Background color: via the color resource named gc_background. Note: this color resource is global to all Activities (CameraActivity, , ReviewActivity, AnalysisActivity)

    Important: All overridden styles must have their respective Root. prefixed style as their parent. Ex.: the parent of GiniCaptureTheme.Review.BottomPanel.TextStyle must be Root.GiniCaptureTheme.Review.BottomPanel.TextStyle.

    Customizing the Action Bar Customizing the Action Bar is also done via overriding of app resources and each one - except the title string resource - is global to all Activities (CameraActivity, , ReviewActivity, AnalysisActivity).

    The following items are customizable:

    • Background color: via the color resource named gc_action_bar (highly recommended for Android 5+: customize the status bar color via gc_status_bar)
    • Title: via the string resource you set in your AndroidManifest.xml when declaring your Activity that extends ReviewActivity. The default title string resource is named gc_title_review
    • Title color: via the color resource named gc_action_bar_title
    • Back button: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named gc_action_bar_back
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
    • Constructor Summary

      Constructors 
      Constructor Description
    • Enum Constant Summary

      Enum Constants 
      Enum Constant Description
    • Method Summary

      Modifier and Type Method Description
      boolean onOptionsItemSelected(MenuItem item)
      void onBackPressed()
      void onProceedToAnalysisScreen(@NonNull() Document document, @Nullable() String errorMessage) Called when the user tapped on the Next button and one of the following conditions apply:
      • Analysis is in progress
      • Analysis completed with an error
      • The image was rotated

        You should start your Activity extending AnalysisActivity and set the document as the EXTRA_IN_DOCUMENT extra.

      void onError(@NonNull() GiniCaptureError error) Called when an error occurred.
      void setListener(@NonNull() ReviewFragmentListener listener) Set a listener for review events.
      • Methods inherited from class androidx.appcompat.app.AppCompatActivity

        addContentView, closeOptionsMenu, dispatchKeyEvent, findViewById, getDelegate, getDrawerToggleDelegate, getMenuInflater, getResources, getSupportActionBar, getSupportParentActivityIntent, invalidateOptionsMenu, onConfigurationChanged, onContentChanged, onCreateSupportNavigateUpTaskStack, onKeyDown, onMenuItemSelected, onMenuOpened, onPanelClosed, onPrepareSupportNavigateUpTaskStack, onSupportActionModeFinished, onSupportActionModeStarted, onSupportContentChanged, onSupportNavigateUp, onWindowStartingSupportActionMode, openOptionsMenu, setContentView, setSupportActionBar, setSupportProgress, setSupportProgressBarIndeterminate, setSupportProgressBarIndeterminateVisibility, setSupportProgressBarVisibility, setTheme, startSupportActionMode, supportInvalidateOptionsMenu, supportNavigateUpTo, supportRequestWindowFeature, supportShouldUpRecreateTask
      • Methods inherited from class androidx.fragment.app.FragmentActivity

        dump, getSupportFragmentManager, getSupportLoaderManager, onAttachFragment, onCreatePanelMenu, onCreateView, onLowMemory, onMultiWindowModeChanged, onPictureInPictureModeChanged, onPreparePanel, onRequestPermissionsResult, onStateNotSaved, setEnterSharedElementCallback, setExitSharedElementCallback, startActivityFromFragment, startIntentSenderFromFragment, supportFinishAfterTransition, supportPostponeEnterTransition, supportStartPostponedEnterTransition, validateRequestPermissionsRequestCode
      • Methods inherited from class androidx.activity.ComponentActivity

        addOnContextAvailableListener, getActivityResultRegistry, getDefaultViewModelProviderFactory, getLastCustomNonConfigurationInstance, getLifecycle, getOnBackPressedDispatcher, getSavedStateRegistry, getViewModelStore, onRetainCustomNonConfigurationInstance, onRetainNonConfigurationInstance, peekAvailableContext, registerForActivityResult, removeOnContextAvailableListener, reportFullyDrawn, startActivityForResult, startIntentSenderForResult
      • Methods inherited from class androidx.core.app.ComponentActivity

        dispatchKeyShortcutEvent, getExtraData, putExtraData, superDispatchKeyEvent
      • Methods inherited from class android.app.Activity

        closeContextMenu, createPendingResult, dismissDialog, dismissKeyboardShortcutsHelper, dispatchGenericMotionEvent, dispatchPopulateAccessibilityEvent, dispatchTouchEvent, dispatchTrackballEvent, enterPictureInPictureMode, enterPictureInPictureMode, finish, finishActivity, finishActivityFromChild, finishAffinity, finishAfterTransition, finishAndRemoveTask, finishFromChild, getActionBar, getApplication, getCallingActivity, getCallingPackage, getChangingConfigurations, getComponentName, getContentScene, getContentTransitionManager, getCurrentFocus, getFragmentManager, getIntent, getLastNonConfigurationInstance, getLayoutInflater, getLoaderManager, getLocalClassName, getMaxNumPictureInPictureActions, getMediaController, getParent, getParentActivityIntent, getPreferences, getReferrer, getRequestedOrientation, getSearchEvent, getSplashScreen, getSystemService, getTaskId, getTitle, getTitleColor, getVoiceInteractor, getVolumeControlStream, getWindow, getWindowManager, hasWindowFocus, isActivityTransitionRunning, isChangingConfigurations, isChild, isDestroyed, isFinishing, isImmersive, isInMultiWindowMode, isInPictureInPictureMode, isLaunchedFromBubble, isLocalVoiceInteractionSupported, isTaskRoot, isVoiceInteraction, isVoiceInteractionRoot, managedQuery, moveTaskToBack, navigateUpTo, navigateUpToFromChild, onActionModeFinished, onActionModeStarted, onActivityReenter, onAttachedToWindow, onContextItemSelected, onContextMenuClosed, onCreateContextMenu, onCreateDescription, onCreateNavigateUpTaskStack, onCreateOptionsMenu, onCreatePanelView, onCreateThumbnail, onDetachedFromWindow, onEnterAnimationComplete, onGenericMotionEvent, onGetDirectActions, onKeyLongPress, onKeyMultiple, onKeyShortcut, onKeyUp, onLocalVoiceInteractionStarted, onLocalVoiceInteractionStopped, onNavigateUp, onNavigateUpFromChild, onOptionsMenuClosed, onPerformDirectAction, onPictureInPictureRequested, onPictureInPictureUiStateChanged, onPrepareNavigateUpTaskStack, onPrepareOptionsMenu, onProvideAssistContent, onProvideAssistData, onProvideKeyboardShortcuts, onProvideReferrer, onSearchRequested, onTopResumedActivityChanged, onTouchEvent, onTrackballEvent, onTrimMemory, onUserInteraction, onVisibleBehindCanceled, onWindowAttributesChanged, onWindowFocusChanged, onWindowStartingActionMode, openContextMenu, overridePendingTransition, postponeEnterTransition, recreate, registerActivityLifecycleCallbacks, registerForContextMenu, releaseInstance, removeDialog, requestDragAndDropPermissions, requestPermissions, requestShowKeyboardShortcuts, requestVisibleBehind, requestWindowFeature, requireViewById, runOnUiThread, setActionBar, setContentTransitionManager, setDefaultKeyMode, setFeatureDrawable, setFeatureDrawableAlpha, setFeatureDrawableResource, setFeatureDrawableUri, setFinishOnTouchOutside, setImmersive, setInheritShowWhenLocked, setIntent, setLocusContext, setMediaController, setPictureInPictureParams, setProgress, setProgressBarIndeterminate, setProgressBarIndeterminateVisibility, setProgressBarVisibility, setRequestedOrientation, setResult, setSecondaryProgress, setShowWhenLocked, setTaskDescription, setTitle, setTitleColor, setTranslucent, setTurnScreenOn, setVisible, setVolumeControlStream, setVrModeEnabled, shouldShowRequestPermissionRationale, shouldUpRecreateTask, showAssist, showDialog, showDialog, showLockTaskEscapeMessage, startActionMode, startActivities, startActivity, startActivityFromChild, startActivityIfNeeded, startIntentSender, startIntentSenderFromChild, startLocalVoiceInteraction, startLockTask, startManagingCursor, startNextMatchingActivity, startPostponedEnterTransition, startSearch, stopLocalVoiceInteraction, stopLockTask, stopManagingCursor, takeKeyEvents, triggerSearch, unregisterActivityLifecycleCallbacks, unregisterForContextMenu
      • Methods inherited from class android.view.ContextThemeWrapper

        applyOverrideConfiguration, getAssets, getTheme
      • Methods inherited from class android.content.ContextWrapper

        bindIsolatedService, bindService, bindServiceAsUser, checkCallingOrSelfPermission, checkCallingOrSelfUriPermission, checkCallingOrSelfUriPermissions, checkCallingPermission, checkCallingUriPermission, checkCallingUriPermissions, checkPermission, checkSelfPermission, checkUriPermission, checkUriPermissions, clearWallpaper, createAttributionContext, createConfigurationContext, createContext, createContextForSplit, createDeviceProtectedStorageContext, createDisplayContext, createPackageContext, createWindowContext, databaseList, deleteDatabase, deleteFile, deleteSharedPreferences, enforceCallingOrSelfPermission, enforceCallingOrSelfUriPermission, enforceCallingPermission, enforceCallingUriPermission, enforcePermission, enforceUriPermission, fileList, getApplicationContext, getApplicationInfo, getAttributionSource, getAttributionTag, getBaseContext, getCacheDir, getClassLoader, getCodeCacheDir, getContentResolver, getDataDir, getDatabasePath, getDir, getDisplay, getExternalCacheDir, getExternalCacheDirs, getExternalFilesDir, getExternalFilesDirs, getExternalMediaDirs, getFileStreamPath, getFilesDir, getMainExecutor, getMainLooper, getNoBackupFilesDir, getObbDir, getObbDirs, getOpPackageName, getPackageCodePath, getPackageManager, getPackageName, getPackageResourcePath, getParams, getSharedPreferences, getSystemServiceName, getWallpaper, getWallpaperDesiredMinimumHeight, getWallpaperDesiredMinimumWidth, grantUriPermission, isDeviceProtectedStorage, isRestricted, isUiContext, moveDatabaseFrom, moveSharedPreferencesFrom, openFileInput, openFileOutput, openOrCreateDatabase, peekWallpaper, registerReceiver, removeStickyBroadcast, removeStickyBroadcastAsUser, revokeUriPermission, sendBroadcast, sendBroadcastAsUser, sendOrderedBroadcast, sendOrderedBroadcastAsUser, sendStickyBroadcast, sendStickyBroadcastAsUser, sendStickyOrderedBroadcast, sendStickyOrderedBroadcastAsUser, setWallpaper, startForegroundService, startInstrumentation, startService, stopService, unbindService, unregisterReceiver, updateServiceGroup
      • Methods inherited from class android.content.Context

        getColor, getColorStateList, getDrawable, getString, getSystemService, getText, obtainStyledAttributes, registerComponentCallbacks, sendBroadcastWithMultiplePermissions, unregisterComponentCallbacks
      • Methods inherited from class android.view.Window.Callback

        onPointerCaptureChanged
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

    • Method Detail

      • onProceedToAnalysisScreen

         void onProceedToAnalysisScreen(@NonNull() Document document, @Nullable() String errorMessage)

        Called when the user tapped on the Next button and one of the following conditions apply:

        • Analysis is in progress
        • Analysis completed with an error
        • The image was rotated

          You should start your Activity extending AnalysisActivity and set the document as the EXTRA_IN_DOCUMENT extra.

        Parameters:
        document - contains the reviewed image (can be the original one or a modified image)
        errorMessage - an optional error message to be passed to the Analysis Screen
      • setListener

         void setListener(@NonNull() ReviewFragmentListener listener)

        Set a listener for review events.

        By default the hosting Activity is expected to implement the . 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.

        Parameters:
        listener - ReviewFragmentListener instance