Android Open Source - Wizard Wizard Builder






From Project

Back to project page Wizard.

License

The source code is released under:

Apache License

If you think the Android project Wizard listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package me.panavtec.wizard;
//  w w  w  .j a  v a 2  s .c om
import android.support.v7.app.ActionBarActivity;

public class WizardBuilder {

    private ActionBarActivity activity;
    private WizardPage[] pages;
    private int containerId;
    private int enterAnimation;
    private int exitAnimation;
    private int popEnterAnimation;
    private int popExitAnimation;
    private WizardPageListener pageListener;
    private WizardListener wizardListener;

    public WizardBuilder(ActionBarActivity activity, WizardPage... pages) {
        if (activity == null) {
            throw new IllegalArgumentException("Activity must not be null.");
        }
        this.activity = activity;

        if (pages == null) {
            throw new IllegalArgumentException("Pages must not be null.");
        }
        this.pages = pages;
    }

    public WizardBuilder containerId(int containerId) {
        this.containerId = containerId;
        return this;
    }

    public WizardBuilder enterAnimation(int enterAnimation) {
        this.enterAnimation = enterAnimation;
        return this;
    }

    public WizardBuilder exitAnimation(int exitAnimation) {
        this.exitAnimation = exitAnimation;
        return this;
    }

    public WizardBuilder popEnterAnimation(int popEnterAnimation) {
        this.popEnterAnimation = popEnterAnimation;
        return this;
    }

    public WizardBuilder popExitAnimation(int popExitAnimation) {
        this.popExitAnimation = popExitAnimation;
        return this;
    }

    public WizardBuilder pageListener(WizardPageListener pageListener) {
        this.pageListener = pageListener;
        return this;
    }

    public WizardBuilder wizardListener(WizardListener wizardListener) {
        this.wizardListener = wizardListener;
        return this;
    }

    public Wizard build() {

        if (pages == null || pages.length == 0) {
            throw new RuntimeException("No page list configured or empty. If you don't " +
                    "have pages why you need Merlin?");
        }

        if (activity == null) {
            throw new RuntimeException("No activity configured, Wizard needs an Activity to work. " +
                    "set activity with builder.activity(activity)");
        }

        if (containerId == 0) {
            containerId = android.R.id.content;
        }

        return new Wizard(activity, pages, containerId, pageListener, wizardListener,
                enterAnimation, exitAnimation, popEnterAnimation, popExitAnimation);
    }

}




Java Source Code List

me.panavtec.gandalf.ApplicationTest.java
me.panavtec.wizard.WizardBuilder.java
me.panavtec.wizard.WizardListener.java
me.panavtec.wizard.WizardPageListener.java
me.panavtec.wizard.WizardPage.java
me.panavtec.wizard.Wizard.java
me.panavtec.wizardsample.Fragment1.java
me.panavtec.wizardsample.Fragment2.java
me.panavtec.wizardsample.Fragment3.java
me.panavtec.wizardsample.MainActivity.java
me.panavtec.wizardsample.WizardPage1.java
me.panavtec.wizardsample.WizardPage2.java
me.panavtec.wizardsample.WizardPage3.java