Material-Onboarding

A short and simple library which allows easy replication of several app onboarding techniqies.

Background

The Material Design guidelines list a lot of different techniques for onboarding users in your apps. The main concept is to remain as simple as possible, and do away with complicated introductions to your app.

What's Included

For now, this library only allows the creation of the TopUserBenefitsModel technique. Later on, it will make use of the other techniques as well.

Enough Talking. How do I use this?

First off, add the Gradle dependency to your app:

// Add the following lines in your apps build.gradle file
repositories {
    maven {
        url  "https://dl.bintray.com/vexigon/maven"
    }
}

dependencies {
    // ...
    compile 'com.vexigon:Material-Onboarding:1.2'
}

Next, add a manifest activity declaration, and set its theme. NOTE: Make sure your theme's parent is Sometheme.NoActionBar otherwise your onboarding activity will have a toolbar.

<activity
    android:name="com.vexigon.libraries.onboarding.ui.activity.UserBenefitsActivity"
    android:theme="@style/Onboarding" />

And now, the fun part! Create a new TopUserBenefitsModel instance like this:

new TopUserBenefitsModel(this)
    .setupSlides(
            new Page("Title 1", "Subtitle 1", R.mipmap.ic_launcher),
            new Page("Title 2", "Subtitle 2", R.mipmap.ic_launcher),
            new Page("Title 3", "Subtitle 3", "Custom Button Text", R.mipmap.ic_launcher)
    )
    .launch();

Code Overview

Below, you'll find info for each of the methods for setting up your onboarding activity.

new TopUserBenefitsModel(Activity activity)

The constructor takes an activity as its parameter.

// For launching from activity...
@Override
public void onClick(View v) {
    switch (v.getId()) {
        case R.id.demo:
            new TopUserBenefitsModel(this)
                    ...
            break;
    }
}

setupSlides()

This method takes a String array of titles for each slide. The items in the array correspond to the title on each slide. (Array position 0 sets the title of the first slide, and so on.)

// Sample
new TopUserBenefitsModel(Activity activity)
    .setupSlides(
            new Page("Title 1", "Subtitle 1", R.mipmap.ic_launcher),
            new Page("Title 2", "Subtitle 2", R.mipmap.ic_launcher),
            new Page("Title 3", "Subtitle 3", "Custom Button Text", R.mipmap.ic_launcher)
    );

Page object

The SSPage object takes 4 parameters total. See below:

// 3 required
new Page(String pageTitle, String pageSubtitle, int drawableResource);

// 1 optional
new Page(String pageTitle, String pageSubtitle, String buttonText, int drawableResource);

launch()

This method launches the activity. No parameters are required.

GitHub