public class OnboardingActivity extends AppCompatActivity implements OnboardingFragmentListener
When you use the Screen API, the OnboardingActivity
displays important advice for
correctly photographing a document.
The OnboardingActivity
is started by the CameraActivity
when the latter is
launched for the first time. You may disable this behavior - we highly recommend keeping it - by
passing false
to GiniVision.Builder#setShouldShowOnboardingAtFirstRun(boolean)
when creating a GiniVision
instance. If you don't use GiniVision
yet you can also
use the extra CameraActivity.EXTRA_IN_SHOW_ONBOARDING_AT_FIRST_RUN
with false
when starting the CameraActivity
.
You can change the number of displayed pages and their content (image and short text) by
setting an ArrayList
containing OnboardingPage
objects when building a GiniVision
instance with GiniVision.Builder#setCustomOnboardingPages(ArrayList)
. If you
don't use GiniVision
yet you can also provide the list using the extra CameraActivity.EXTRA_IN_ONBOARDING_PAGES
for the Screen API and OnboardingFragmentCompat.createInstance(ArrayList)
or OnboardingFragmentStandard.createInstance(ArrayList)
for the Component API.
Customizing the look of the Onboarding Screen is done via overriding of app resources or by providing your own pages with your own strings and drawable resources.
The following items are customizable:
gv_onboarding_fab_next.png
gv_onboarding_fab
and gv_onboarding_fab_pressed
gv_onboarding_indicator_active.png
and gv_onboarding_indicator_inactive.png
gv_onboarding_message
GiniVisionTheme.Onboarding.Message.TextStyle
and setting an item named gvCustomFont
with
the path to the font file in your assets
folder
GiniVisionTheme.Onboarding.Message.TextStyle
and setting an item named android:textStyle
to normal
, bold
or italic
GiniVisionTheme.Onboarding.Message.TextStyle
and setting an item named android:textSize
to the desired sp
size
gv_onboarding_lighting.png
gv_onboarding_ligthing
gv_onboarding_flat.png
gv_onboarding_flat
gv_onboarding_parallel.png
gv_onboarding_parallel
gv_onboarding_align.png
gv_onboarding_align
gv_onboarding_flat.png
gv_onboarding_flat
gv_onboarding_parallel.png
gv_onboarding_parallel
gv_onboarding_align.png
gv_onboarding_align
gv_onboarding_page_fragment_background_alpha
which must contain a real number between [0,1].
gv_background
. Note:
this color resource is global to all Activities (CameraActivity
, OnboardingActivity
, ReviewActivity
, AnalysisActivity
)
Important: All overriden styles must have their respective Root.
prefixed
style as their parent. Ex.: the parent of GiniVisionTheme.Onboarding.Message.TextStyle
must be Root.GiniVisionTheme.Onboarding.Message.TextStyle
.
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
, OnboardingActivity
, ReviewActivity
, AnalysisActivity
).
The following items are customizable:
gv_action_bar
(highly
recommended for Android 5+: customize the status bar color via gv_status_bar
)
gv_title_onboarding
gv_action_bar_title
gv_action_bar_back
Constructor and Description |
---|
OnboardingActivity() |
Modifier and Type | Method and Description |
---|---|
void |
onCloseOnboarding()
Called when the user has left the last page - either by swiping or tapping on the Next button - and you should
close the Onboarding Fragment.
|
void |
onError(GiniVisionError giniVisionError)
Called when an error occurred.
|
boolean |
onOptionsItemSelected(MenuItem item) |
public boolean onOptionsItemSelected(MenuItem item)
public void onCloseOnboarding()
OnboardingFragmentListener
Called when the user has left the last page - either by swiping or tapping on the Next button - and you should close the Onboarding Fragment.
onCloseOnboarding
in interface OnboardingFragmentListener
public void onError(GiniVisionError giniVisionError)
OnboardingFragmentListener
Called when an error occurred.
onError
in interface OnboardingFragmentListener
giniVisionError
- details about what went wrong