Package net.gini.android.vision.noresults

Contains the Activity and Fragments used for the No Results Screen. The No Results Screen includes hints on how to take a picture in an optimal condition. This screen should be shown when the received results from the Gini API don't include the required extractions.

Screen API

The net.gini.android.vision.noresults.NoResultsActivity is launched directly by the net.gini.android.vision.analysis.AnalysisActivity or the net.gini.android.vision.review.ReviewActivity, depending on where analysis results were received.

Call net.gini.android.vision.analysis.AnalysisFragmentInterface#onNoExtractionsFound() or net.gini.android.vision.review.ReviewFragmentInterface#onNoExtractionsFound() after you received the results from the Gini API and it didn't include the required extractions.

Component API

To use the Component API you have to include the net.gini.android.vision.noresults.NoResultsFragmentStandard or the net.gini.android.vision.noresults.NoResultsFragmentCompat in an Activity in your app (a dedicated Activity is recommended). To receive events from the Fragments your Activity must implement the net.gini.android.vision.noresults.NoResultsFragmentListener interface.

Types

NoResultsActivity
Link copied to clipboard

Screen API

When you use the Screen API, the {@code NoResultsFragmentCompat} displays hints that show how to best take a picture of a document.

Customizing the No Results Screen

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

The following items are customizable:

  • Header icon: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named {@code gv_alert_icon.png}
  • Header text color: via the color resource named {@code * gv_noresults_header}
  • Header text font: via overriding the style named {@code GiniVisionTheme * .NoResults.Header.TextStyle} and setting an item named {@code gvCustomFont} with the path to the font file in your {@code assets} folder
  • Header text style: via overriding the style named {@code GiniVisionTheme.NoResults.Header.TextStyle} and setting an item named {@code android:textStyle} to {@code normal} , {@code bold} or {@code italic}
  • Header text size: via overriding the style named {@code GiniVisionTheme.NoResults.Header.TextStyle} and setting an item named {@code android:textSize} to the desired {@code sp} size
  • Headline text color: via the color resource named {@code gv_noresults_headline}
  • Headline text font: via overriding the style named {@code GiniVisionTheme.NoResults.Headline.TextStyle} and setting an item named {@code gvCustomFont} with the path to the font file in your {@code assets} folder
  • Headline text style: via overriding the style named {@code GiniVisionTheme.NoResults.Headline.TextStyle} and setting an item named {@code android:textStyle} to {@code normal} , {@code bold} or {@code italic}
  • Headline text size: via overriding the style named {@code GiniVisionTheme.NoResults.Headline.TextStyle} and setting an item named {@code android:textSize} to the desired {@code sp} size
  • Tip text color: via the color resource named {@code gv_noresults_tip}
  • Tip text font: via overriding the style named {@code GiniVisionTheme.NoResults.Tip.TextStyle} and setting an item named {@code gvCustomFont} with the path to the font file in your {@code assets} folder
  • Tip text style: via overriding the style named {@code GiniVisionTheme.NoResults.Tip.TextStyle} and setting an item named {@code android:textStyle} to {@code normal} , {@code bold} or {@code italic}
  • Tip text size: via overriding the style named {@code GiniVisionTheme.NoResults.Tip.TextStyle} and setting an item named {@code android:textSize} to the desired {@code sp} size
  • Tip image - Good lighting: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named {@code gv_photo_tip_lighting.png}
  • Tip image - Document should be flat: via images for mdpi, hdpi, xhdpi, xxhdpi, xxxhdpi named {@code gv_photo_tip_flat.png}
  • Tip image - Device should be parallel to document: via images for mdpi, hdpi, xhdpi,xxhdpi, xxxhdpi named {@code gv_photo_tip_parallel.png}
  • Tip image - Document should be aligned with corner guides: via images for mdpi, hdpi, xhdpi,xxhdpi, xxxhdpi named {@code gv_photo_tip_align.png}
  • Button color: via the color resource named {@code gv_noresults_button}
  • Button text color: via the color resource named {@code gv_noresults_button_text}
  • Background color: via the color resource named {@code gv_noresults_background} .

Important: All overriden styles must have their respective {@code Root.} prefixed style as their parent. Ex.: the parent of {@code GiniVisionTheme.Onboarding.Message.TextStyle} must be {@code Root.GiniVisionTheme.Onboarding.Message.TextStyle} .

Customizing the Action Bar

Customizing the Action Bar is 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 {@code gv_action_bar} (highly recommended for Android 5+: customize the status bar color via {@code gv_status_bar} )

public class NoResultsActivity extends AppCompatActivity implements NoResultsFragmentListener
NoResultsFragmentCompat
Link copied to clipboard

Component API

When you use the Component API with the Android Support Library, the {@code * NoResultsFragmentCompat} displays hints that show how to best take a picture of a document.

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

Your Activity must implement the NoResultsFragmentListener interface to receive events from the No Results Fragment. Failing to do so will throw an exception.

Your Activity is automatically set as the listener in onCreate .

public class NoResultsFragmentCompat extends Fragment implements FragmentImplCallback
NoResultsFragmentHelper
Link copied to clipboard
final class NoResultsFragmentHelper
NoResultsFragmentImpl
Link copied to clipboard
class NoResultsFragmentImpl
NoResultsFragmentListener
Link copied to clipboard

Interface used by NoResultsFragmentStandard and NoResultsFragmentCompat to dispatch events to the hosting Activity.

public interface NoResultsFragmentListener
NoResultsFragmentStandard
Link copied to clipboard

Component API

When you use the Component API without the Android Support Library, the {@code * NoResultsFragmentStandard} displays hints that show how to best take a picture of a document.

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

Your Activity must implement the NoResultsFragmentListener interface to receive events from the No Results Fragment. Failing to do so will throw an exception.

Your Activity is automatically set as the listener in onCreate .

public class NoResultsFragmentStandard extends Fragment implements FragmentImplCallback