Giter Site home page Giter Site logo

appintro's Introduction

Maven Central Android Arsenal Android Gems

Sample App:

Get it on Google Play

AppIntro

AppIntro is an Android Library that helps you make a cool intro for your app, like the ones in Google apps.

Watch YouTube video here.

##How to use Add this to your build.gradle:

repositories {
    mavenCentral()
}

dependencies {
  compile 'com.github.paolorotolo:appintro:3.4.0'
}

Create a new Activity that extends AppIntro:

public class MyIntro extends AppIntro {

    // Please DO NOT override onCreate. Use init.
    @Override
    public void init(Bundle savedInstanceState) {

        // Add your slide's fragments here.
        // AppIntro will automatically generate the dots indicator and buttons.
        addSlide(first_fragment);
        addSlide(second_fragment);
        addSlide(third_fragment);
        addSlide(fourth_fragment);
        
        // Instead of fragments, you can also use our default slide
        // Just set a title, description, background and image. AppIntro will do the rest.
        addSlide(AppIntroFragment.newInstance(title, description, image, background_colour));

        // OPTIONAL METHODS
        // Override bar/separator color.
        setBarColor(Color.parseColor("#3F51B5"));
        setSeparatorColor(Color.parseColor("#2196F3"));

        // Hide Skip/Done button.
        showSkipButton(false);
        setProgressButtonEnabled(false);

        // Turn vibration on and set intensity.
        // NOTE: you will probably need to ask VIBRATE permisssion in Manifest.
        setVibrate(true);
        setVibrateIntensity(30);
    }

    @Override
    public void onSkipPressed() {
    // Do something when users tap on Skip button.
    }

    @Override
    public void onDonePressed() {
    // Do something when users tap on Done button.
    }
    
        @Override
    public void onSlideChanged() {
    // Do something when the slide changes.
    }

    @Override
    public void onNextPressed() {
    // Do something when users tap on Next button.
    }

}

Please, DO NOT override onCreate. Use init instead.

Finally, declare the activity in your Manifest like so:

<activity android:name="com.example.example.intro"
    android:label="@string/app_intro" />

Do not declare the intro as your main app launcher unless you want the intro to launch every time your app starts. Refer to the wiki for an example of how to launch the intro once from your main activity.

Layout 2

If you want to try new layout (as seen in Google's Photo app), just extend AppIntro2 in your Activity. That's all :)

public class MyIntro extends AppIntro2 {
    [...]
}


### Easy implementation of Slide Fragments As you can see, things have changed in AppIntro 3.0.0. Now it's so easy to add new slides to AppIntro.
For example: * Copy the class **SampleSlide** from my [example project](https://github.com/PaoloRotolo/AppIntro/blob/master/example/src/main/java/com/github/paolorotolo/appintroexample/SampleSlide.java). * Add a new slide with ```addSlide(SampleSlide.newInstance(R.layout.your_slide_here));```

There's no need to create one class for fragment anymore. :)

I've never used fragments...

No problem, just use this method and AppIntro will generate a new slide for you.

addSlide(AppIntroFragment.newInstance(title, description, image, background_colour));

Animations

AppIntro comes with some pager animations. Choose the one you like and then active it with:

// Put this method in init()
setFadeAnimation();

Available animations:

setFadeAnimation()
setZoomAnimation()
setFlowAnimation()
setSlideOverAnimation()
setDepthAnimation()

If you want to create nice parallax effect or your own custom animation, create your own PageTransformer and call:

// Put this method in init()
setCustomTransformer(transformer);

Click here to see how I did it in the example app.

Android 6.0 ready

Android 6.0 introduced a new permissions model for developers. Now all your apps have to request permissions which can be a tedious thing to implement.

However, AppIntro simplifies this down to one single line of code!

// Put this in init()
askForPermissions(new String[]{Manifest.permission.CAMERA}, 2); // OR

// This will ask for the camera permission AND the contacts permission on the same slide. 
// Ensure your slide talks about both so as not to confuse the user.
askForPermissions(new String[]{Manifest.permision.CAMERA, Manifest.permission.READ_CONTACTS}, 2); 

NOTE: It is advised that you only put one permission in the String array unless you want the app to ask for multiple permissions on the same slide.

Example

See example code here on Github. You can also see it live. Download this app from Google Play..

Real life examples

Do you need inspiration? A lot of apps are using AppIntro out there:

Planets

Hermes - Material IRC Client

Apps using AppIntro

If you are using AppIntro in your app and would like to be listed here, please let us know by opening a new issue!

appintro's People

Contributors

paolorotolo avatar maxee avatar danluong avatar mhzdev avatar cr5315 avatar tasomaniac avatar juliocbcotta avatar rohitshampur avatar fleker avatar sandromachado avatar llin233 avatar marbat87 avatar salimkayabasi avatar girish3 avatar avluis avatar kayvannj avatar championswimmer avatar fanky10 avatar liaohuqiu avatar macroyau avatar niharg15 avatar ofirmiron avatar deinlandel avatar milosjovac avatar skadyrov avatar sleepingant avatar smanikandan14 avatar

Watchers

James Cloos avatar Pony avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.