public class ReviewFragmentCompat extends Fragment implements ReviewFragmentInterface
When you use the Compontent API with the Android Support Library, the ReviewFragmentCompat
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.
Note: Your Activity hosting this Fragment must extend the android.support.v7.app.AppCompatActivity
and use an AppCompat Theme.
Include the ReviewFragmentCompat
into your layout by using the ReviewFragmentCompat.createInstance(Document)
factory method to create an instance and display
it using the android.support.v4.app.FragmentManager
.
A ReviewFragmentListener
instance must be available until the ReviewFragmentCompat
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
ReviewFragmentListener
interface or explicitly by setting the listener using ReviewFragmentCompat.setListener(ReviewFragmentListener)
.
Your Activity is automatically set as the listener in ReviewFragmentCompat.onCreate(Bundle)
.
ReviewActivity
for details.Constructor and Description |
---|
ReviewFragmentCompat() |
Modifier and Type | Method and Description |
---|---|
static ReviewFragmentCompat |
createInstance(Document document)
Factory method for creating a new instance of the Fragment using the provided document.
|
void |
onDocumentAnalyzed()
You should call this method after you've received the analysis results from the Gini API.
|
void |
onNoExtractionsFound()
You should call this method after you've received the analysis results from the Gini API
without the required extractions.
|
void |
onSaveInstanceState(Bundle outState) |
void |
setListener(ReviewFragmentListener listener)
Set a listener for review events.
|
void |
showAlertDialog(java.lang.String message,
java.lang.String positiveButtonTitle,
DialogInterface.OnClickListener positiveButtonClickListener,
java.lang.String negativeButtonTitle,
DialogInterface.OnClickListener negativeButtonClickListener,
DialogInterface.OnCancelListener cancelListener) |
public static ReviewFragmentCompat createInstance(Document document)
Factory method for creating a new instance of the Fragment using the provided document.
Note: Always use this method to create new instances. Document is required and an exception is thrown if it's missing.
document
- must be the Document
from CameraFragmentListener.onDocumentAvailable(Document)
public void showAlertDialog(java.lang.String message, java.lang.String positiveButtonTitle, DialogInterface.OnClickListener positiveButtonClickListener, java.lang.String negativeButtonTitle, DialogInterface.OnClickListener negativeButtonClickListener, DialogInterface.OnCancelListener cancelListener)
public void onSaveInstanceState(Bundle outState)
public void onDocumentAnalyzed()
ReviewFragmentInterface
This is important for managing the behavior of the Review Document Fragment when the Next button was clicked.
If the document has already been analyzed and the image wasn't changed when the user
tapped the Next button, ReviewFragmentListener.onDocumentReviewedAndAnalyzed(Document)
is called and there is no need to show an AnalysisActivity
or AnalysisFragmentStandard
or AnalysisFragmentCompat
.
If the document wasn't analyzed or the image was changed when the user tapped the Next
button, ReviewFragmentListener.onProceedToAnalysisScreen(Document)
is called.
onDocumentAnalyzed
in interface ReviewFragmentInterface
public void onNoExtractionsFound()
ReviewFragmentInterface
onNoExtractionsFound
in interface ReviewFragmentInterface
public void setListener(ReviewFragmentListener listener)
ReviewFragmentInterface
By default the hosting Activity is expected to implement the ReviewFragmentListener
. 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.
setListener
in interface ReviewFragmentInterface
listener
- ReviewFragmentListener
instance