Skip to content

IntroductionBuilder

Ruben Gees edited this page Sep 30, 2015 · 7 revisions

Specific implementation details for the IntroductionBuilder

withSlides(List slides)

Add your Slides to the Builder. See the Wiki page for Slide to see how to implement a Slide.

withStyle(int style)

Specify the Style to use. There are currently 2 available Styles: TranslucentStyle and FullscreenStyle. Specify them like the following:

new IntroductionBuilder(this).withSlides(generateSlides())
                .withStyle(new FullscreenStyle()).introduceMyself();

The default Style is Translucent.

withIndicatorManager(IndicatorManager manager)

Use a custom IndicatorManager. See the wiki page for a custom IndicatorManager to see how to implement one. Use it like the following:

new IntroductionBuilder(this).withSlides(generateSlides()).withIndicatorManager(new MyCustomIndicatorManager())
                .introduceMyself();

withPreviousButtonEnabled(boolean enabled)

Enable or disable the "previous"-Button. Note: It will be still possible to move backwards as the user still can scroll through the Slides.

withIndicatorEnabled(boolean enabled)

Enable or disable the Indicator. If disabled there will be no Indicator at the bottom, even if you specified a custom one.

withForcedOrientation(int orientation)

Force a Orientation, disabling the ability to rotate the Device. This is for design purposes. Available are portrait, landscape and both. The default is both.

withOnSlideChangedListener(IntroductionConfiguration.OnSlideChangedListener onSlideChangedListener)

Add a Listener that captures all moves through the Slides and one that notifies you, when a Slide was initialized. The listener looks like the following:

new IntroductionBuilder(this).withSlides(slides)
                .withOnSlideListener(new OnSlideListener() {
                    @Override
                    public void onSlideChanged(int from, int to) {
                        //Do something here
                    }

                    @Override
                    protected void onSlideInit(int position, @NonNull TextView title,
                                               @NonNull ImageView image, @NonNull TextView description) {
                        //Do something here
                    }
                }).introduceMyself();

You can use this listener for various purposes. See the Runtime Permissions and the Asynchronous image loading & GIFs wiki pages for examples.

withPageTransformer(ViewPager.PageTransformer pageTransformer)

Apply a custom PageTransformer to display cool animations. See the classes DepthPageTransformer and ZoomOutPageTransformer in the sample for working implementations.

introduceMyself()

Call this method if you did all of the configurations you wanted to finally start the Activity with your Slides.