Review Activity
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. Extending the ReviewActivity
in your application has been deprecated. The preferred way of adding network calls to the Gini Vision Library is by creating a GiniVision instance with a GiniVisionNetworkService and a GiniVisionNetworkApi implementation.
Note: When declaring your ReviewActivity
subclass in the
AndroidManifest.xml
you should set the theme to the GiniVisionTheme
and the title to the string resource named gv_title_review
. If you would like to use your own theme please consider that ReviewActivity
extends AppCompatActivity and requires an AppCompat Theme.
The ReviewActivity
is started by the CameraActivity after the user has taken a photo or imported an image of a document.
If you didn't create GiniVision instance you have to implement the following methods in your ReviewActivity
subclass:
- onShouldAnalyzeDocument - you should start analyzing the original document by sending it to the Gini API. We assume that in most cases the photo is good enough and this way we are able to provide analysis results quicker.Note: Call onDocumentAnalyzed when the analysis is done and the Activity wasn't stopped.
- onAddDataToResult - you can add the results of the analysis to the Intent as extras and retrieve them once the CameraActivity returns.This is called only if you called onDocumentAnalyzed and the image wasn't changed before the user tapped on the Next button.When this is called, your subclass is not launched, instead control is returned to your Activity which started the CameraActivity and you can extract the results of the analysis.
- onDocumentWasRotated - you should cancel the analysis started in onShouldAnalyzeDocument because the document was rotated and analysing the original is not necessary anymore. The Gini Vision Library will proceed to the Analysis Screen where the reviewed document can be analyzed.
- onProceedToAnalysisScreen - called when the Gini Vision Library will continue to the Analysis Screen. For example you can unsubscribe your analysis listener, if you want to continue the analysis in your AnalysisActivity subclass in case the document wasn't modified.
- onBackPressed - called when the back or the up button was clicked. You should cancel the analysis started in onShouldAnalyzeDocument.
The following items are customizable:
- Rotate button icon: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named
gv_review_button_rotate.png
- Rotate button color: via the color resources named
gv_review_fab_mini
andgv_review_fab_mini_pressed
- Next button icon: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named
gv_review_fab_next.png
- Next button color: via the color resources named
gv_review_fab
andgv_review_fab_pressed
- Bottom advice text: via the string resource named
gv_review_bottom_panel_text
- Bottom text color: via the color resource named
gv_review_bottom_panel_text
- Bottom text font: via overriding the style named
GiniVisionTheme.Review.BottomPanel.TextStyle
and setting an item namedgvCustomFont
with the path to the font file in yourassets
folder - Bottom text style: via overriding the style named
GiniVisionTheme.Review.BottomPanel.TextStyle
and setting an item namedandroid:textStyle
tonormal
,bold
oritalic
- Bottom text size: via overriding the style named
GiniVisionTheme.Review.BottomPanel.TextStyle
and setting an item namedandroid:textSize
to the desiredsp
size - Bottom panel background color: via the color resource named
gv_review_bottom_panel_background
- Background color: via the color resource named
gv_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 GiniVisionTheme.Review.BottomPanel.TextStyle
must be Root.GiniVisionTheme.Review.BottomPanel.TextStyle
.
The following items are customizable:
- Background color: via the color resource named
gv_action_bar
(highly recommended for Android 5+: customize the status bar color viagv_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 namedgv_title_review
- Title color: via the color resource named
gv_action_bar_title
- Back button: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named
gv_action_bar_back
Functions
- 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.