-
Notifications
You must be signed in to change notification settings - Fork 377
Configure your tutorial with TutorialOptions
TutorialOptions
class that holds all settings of your tutorial. It's required for creating of a new instance of TutorialFragment
or TutorialSupportFragment
. Next sample shows you how to create a new instance of TutorialOptions
class:
final TutorialOptions tutorialOptions = TutorialFragment.newTutorialOptionsBuilder(context)
.setUseAutoRemoveTutorialFragment(...)
.setUseInfiniteScroll(...)
.setPagesColors(...)
.setPagesCount(...)
.setIndicatorOptions(...)
.setTutorialPageProvider(...)
.setOnSkipClickListener(...)
.setPageTransformer(...)
.setNoRollBack(...)
.build();
If you're using support fragments, you should call TutorialSupportFragment.newTutorialOptionsBuilder(Context)
instead.
final TutorialOptions tutorialOptions = TutorialSupportFragment.newTutorialOptionsBuilder(context)
.setUseAutoRemoveTutorialFragment(...)
.setUseInfiniteScroll(...)
.setPagesColors(...)
.setPagesCount(...)
.setIndicatorOptions(...)
.setTutorialPageProvider(...)
.setOnSkipClickListener(...)
.setPageTransformer(...)
.setNoRollBack(...)
.build();
Note: both methods return the same type TutorialOptions
. But if you try to create an instance of TutorialSupportFragment
with TutorialOptions
configured for default Fragment
class this will lead to crash. This rule applies to case when you will try to create an instance of TutorialFragment
with TutorialOptions
configured for support Fragment
class.
Method | Required | Description |
---|---|---|
setPagesCount |
Yes | Set the count of pages in your tutorial |
setPagesColors |
No 1 | Set an array of colors for every page. The size of an array must be equals or greater than pages count. |
setUseAutoRemoveTutorialFragment |
No | If you pass true as an argument, two things will happen:
This allows you to build tutorials that smoothly change its content to your app's content displayed behind the tutorial. |
setUseInfiniteScroll |
No | If you pass true as an argument, tutorial pages will be displayed in the infinite loop. This method ignores setUseAutoRemoveTutorialFragment option. |
setIndicatorOptions |
No 2 | Set a custom indicator options. See Configuring Page Indicator for more details. |
setTutorialPageProvider |
Yes | Set a custom tutorial pages provider. See Configuring Pages for more details. |
setOnSkipClickListener |
No | Set a click listener for Skip button. |
setPageTransformer |
No | Set a custom instance of PageTransformer class. Sliding Tutorial library built on top of ViewPager . If you want to specify your custom page transformer, pass it here. |
setNoRollBack |
No | If you want to avoid scrolling back set this flag false
|
1 - if you will not specify an array of colors then transparent color will be used by default.
2 - if you will not specify an indicator options then default options will be used: a circle indicator with size of elements and spaces of 4dp
.