public class OnboardingFragmentStandard extends Fragment implements OnboardingFragmentInterface
When you use the Component API without the Android Support Library, the OnboardingFragmentStandard
displays important advice for correctly photographing a document.
Include the OnboardingFragmentStandard
into your layout either directly with <fragment>
in your Activity's layout or using the android.app.FragmentManager
.
The default way of showing the Onboarding Screen is as an overlay above the camera preview with a semi-transparent background.
By default an empty last page is added to enable the revealing of the camera preview before the Onboarding Screen is dismissed.
If you would like to display a different number of pages, you can use the OnboardingFragmentStandard.createInstance(ArrayList)
or OnboardingFragmentStandard.createInstanceWithoutEmptyLastPage(ArrayList)
factory method and provide a list of OnboardingPage
objects.
If you would like to disable the appending of the empty last page, you can use the OnboardingFragmentStandard.createInstanceWithoutEmptyLastPage(ArrayList)
or the OnboardingFragmentStandard.createInstanceWithoutEmptyLastPage()
factory method.
An OnboardingFragmentListener
instance must be available until the OnboardingFragmentStandard
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 OnboardingFragmentListener
interface or explicitly by
setting the listener using OnboardingFragmentCompat.setListener(OnboardingFragmentListener)
.
Your Activity is automatically set as the listener in OnboardingFragmentStandard.onCreate(Bundle)
.
See the OnboardingActivity
for details.
Constructor and Description |
---|
OnboardingFragmentStandard() |
Modifier and Type | Method and Description |
---|---|
static OnboardingFragmentStandard |
createInstance(java.util.ArrayList pages)
Factory method for creating a new instance of the Fragment using the provided list of onboarding pages.
|
static OnboardingFragmentStandard |
createInstanceWithoutEmptyLastPage()
Factory method for creating a new instance of the Fragment without appending an empty page to the default pages.
|
static OnboardingFragmentStandard |
createInstanceWithoutEmptyLastPage(java.util.ArrayList pages)
Factory method for creating a new instance of the Fragment using the provided list of onboarding pages.
|
PagerAdapter |
getViewPagerAdapter(java.util.List pages) |
void |
setListener(OnboardingFragmentListener listener)
Set a listener for onboarding 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 OnboardingFragmentStandard createInstanceWithoutEmptyLastPage(java.util.ArrayList pages)
Factory method for creating a new instance of the Fragment using the provided list of onboarding pages.
This method prevents the appending of an empty page to your pages.
If you don't need a custom number of pages and wish to use the default behaviour, you can use the default constructor of OnboardingFragmentCompat
.
pages
- the pages to be shownpublic static OnboardingFragmentStandard createInstance(java.util.ArrayList pages)
Factory method for creating a new instance of the Fragment using the provided list of onboarding pages.
If you would like to prevent the appending of an empty page, you can use the OnboardingFragmentCompat.createInstanceWithoutEmptyLastPage(ArrayList)
factory method.
If you don't need a custom number of pages and wish to use the default behaviour, you can use the default constructor of OnboardingFragmentCompat
.
pages
- the pages to be shownpublic static OnboardingFragmentStandard createInstanceWithoutEmptyLastPage()
Factory method for creating a new instance of the Fragment without appending an empty page to the default pages.
If you wish to use the default behaviour, you can use the default constructor of OnboardingFragmentCompat
.
public PagerAdapter getViewPagerAdapter(java.util.List pages)
public void setListener(OnboardingFragmentListener listener)
OnboardingFragmentInterface
Set a listener for onboarding events.
By default the hosting Activity is expected to implement
the OnboardingFragmentListener
. 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 OnboardingFragmentInterface
listener
- OnboardingFragmentListener
instancepublic void showAlertDialog(java.lang.String message, java.lang.String positiveButtonTitle, DialogInterface.OnClickListener positiveButtonClickListener, java.lang.String negativeButtonTitle, DialogInterface.OnClickListener negativeButtonClickListener, DialogInterface.OnCancelListener cancelListener)