TutorialOptions.Builder#onSkipClickListener(...)
was renamed to TutorialOptions.Builder#setOnSkipClickListener(...)
.
- You must change creation TransformItem from
new TransformItem(R.id.ivFirstImage, true, 20)
toTransformItem.create(R.id.ivFirstImage, Direction.LEFT_TO_RIGHT, 0.2f)
, where 2-nd parameter now is Direction of view translation and 3-rd parameter is shiftCoefficient. - Your fragment with tutorial must extend TutorialFragment instead of PresentationPagerFragment.
- In your TutorialFragment successor fragment must implement TutorialFragment#provideTutorialOptions() method that returns TutorialOptions instance.
import android.support.v4.app.Fragment;
public class CustomTutorialFragment extends TutorialSupportFragment {
private static final int TOTAL_PAGES = 3;
private final TutorialPageProvider<Fragment> mTutorialPageProvider = new TutorialPageProvider<Fragment>() {
@NonNull
@Override
public Fragment providePage(int position) {
switch (position) {
case 0:
return new FirstCustomPageFragment();
case 1:
return new SecondCustomPageFragment();
case 2:
return new ThirdCustomPageFragment();
default:
throw new IllegalArgumentException("Unknown position: " + position);
}
}
};
private int[] pagesColors = new int[] { Color.WHITE, Color.BLUE, Color.RED };
@Override
protected TutorialOptions provideTutorialOptions() {
return newTutorialOptionsBuilder(getContext())
.setUseAutoRemoveTutorialFragment(true)
.setUseInfiniteScroll(false)
.setPagesColors(pagesColors)
.setPagesCount(TOTAL_PAGES)
.setIndicatorOptions(IndicatorOptions.newBuilder(getContext())
.setElementSizeRes(R.dimen.indicator_size)
.setElementSpacingRes(R.dimen.indicator_spacing)
.setElementColorRes(android.R.color.darker_gray)
.setSelectedElementColor(Color.LTGRAY)
.setRenderer(DrawableRenderer.create(getContext()))
.build())
.setTutorialPageProvider(mTutorialPageProvider)
.onSkipClickListener(mOnSkipClickListener)
.build();
}
}
- In TutorialOptions.Builder#setTutorialPageProvider(TutorialPageProvider) you must specify TutorialPageProvider instance. For example:
private final TutorialPageProvider<Fragment> mTutorialPageProvider = new TutorialPageProvider<Fragment>() {
@NonNull
@Override
public Fragment providePage(int position) {
switch (position) {
case 0:
return new FirstCustomPageFragment();
case 1:
return new SecondCustomPageFragment();
case 2:
return new ThirdCustomPageFragment();
default:
throw new IllegalArgumentException("Unknown position: " + position);
}
}
};
- All resources marked as private. Make sure you're not using any resource (strings, dimens, etc) from this library.
- All attributes were renamed, prefix
st_
added. Add this prefix to any custom XML attribute you used. Example:
<com.cleveroad.slidingtutorial.CirclePageIndicator
android:id="@+id/indicator"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
app:st_fillColor="@android:color/white"
app:st_pageColor="@android:color/secondary_text_light_nodisable"
app:st_radius="4dp"
app:st_strokeColor="#00000000"
app:st_strokeWidth="0dp"/>
This class is final now. Make sure you're not extending from it.
This class is package-local now. Make sure you're not using it.
getRootResId() and getBackgroundColorResId() methods are deprecated. You can remove them now. To specify page's color use PresentationPagerFragment.getPageColor(int) method.
getPageFragments() method is deprecated. You can remove it now. Use getPagesCount() and getPage(int) methods instead.
Added isInfinityScrollEnabled() method. Override it and return true
to enable this feature.
NOTE: make sure you're returning new fragment instance when displaying tutorial with infinite scroll enabled.