54

I have Android 5.0 final build flashed in my Nexus 5. I noticed it has very beautiful, clean and elegant way of showing tutorial at first launch. Apps like "Sheets", "Slides" etc.

How can we implement that in our Android L compatible apps?

Also the app fades off the first launch screen and then shows the tutorial.

Tutorial screen 1 Initial screen which fades off and shows the tutorial

Thomas Vos
  • 12,271
  • 5
  • 33
  • 71
Abhishek Balani
  • 3,827
  • 2
  • 24
  • 34

7 Answers7

36

There is a pretty good library for emulating these first run tutorials: https://github.com/PaoloRotolo/AppIntro

AppIntro example screenshot

Click for larger image

Thomas Vos
  • 12,271
  • 5
  • 33
  • 71
Adam
  • 25,966
  • 23
  • 76
  • 87
14

First of all, there's no secret. The quality of the illustrations is the key to get this pretty result. So unless you're a designer yourself, you'll have to find a good designer for them.

Appart from that, I can see several ways to get close to this.

  1. First, there's a very subtle parallax effect on the illustrations. You can achieve it by using this ParallaxTransformPage gist. I use it and it works pretty well.

  2. Also, here's a lib that let you smoothly change the screen's background color while switching pages.

  3. For the splashscreen fade out animation, you can do something like this :

    final ImageView launchScreen = (ImageView) context.findViewById(R.id.launch_screen_view);
    new Handler().postDelayed(new Runnable()
    {
        @Override
        public void run()
        {
            Animation animation = AnimationUtils.loadAnimation(context, android.R.anim.fade_out);
            animation.setAnimationListener(new Animation.AnimationListener()
            {
                // ...
    
                @Override
                public void onAnimationEnd(Animation animation)
                {
                    launchScreen.setVisibility(View.GONE);
                }
            });
            launchScreen.startAnimation(animation);
        }
    }, 2000);
    
  4. Follow linkas's answer for the use of a ViewPagerIndicator and how to launch the tutorial only the first time user launches the app.

Community
  • 1
  • 1
MathieuMaree
  • 7,453
  • 6
  • 26
  • 31
  • This looks close. Thanks. I will implement and will let know. – Abhishek Balani Nov 17 '14 at 14:14
  • Do you also know how to finish the activity (with fade out animation) when the user is trying to swipe out of bounds on the last page (swipe to the left (forward)) just as the Google Sheets app? [This](http://stackoverflow.com/q/13346824/1480019) and [this](http://stackoverflow.com/q/25889115/1480019) is related. –  Dec 23 '14 at 11:27
  • 1
    @GerritHoekstra What you could do is simply put your `ViewPager` in the same layout than your homescreen (on top of the rest of the homescreen), and display/inflate the `ViewPager` only at first launch. You add a 5th "fake" empty page to your `ViewPager`. And while the user swipes to the 5th page, you change the `ViewPager`'s alpha, until finally you set its visibility to GONE when the user releases his finger. – MathieuMaree Dec 23 '14 at 13:10
  • @MathieuMaree Thanks! I've implemented that successful the only thing now is how to hide the fake view from the `CirclePageIndicator` because when I've for example 4 views and 1 fake view it shows 5 circles instead of 4 (which I want), do you know how fix that? –  Dec 23 '14 at 14:16
  • @MathieuMaree Never mind, I've changed the `CirclePageIndicator` to display only 4 circles. Also I've made my activity transparent as described [here](http://stackoverflow.com/a/2700683/1480019) so that I don't have to put the 'tutorial layout' in the same layout as my homescreen. Calculating and changing the alpha happens in `onPageScrolled` with the second argument (`positionOffset`). Thanks for your help! Much appreciated. –  Dec 23 '14 at 17:18
8

This git should help you implement what you want: https://github.com/spongebobrf/MaterialIntroTutorial,

This android Library demonstrating a material intro tutorial much like the ones on Google Sheets, as you mention.

In addition, this library takes the background color set for each page and when scrolling between the two pages, the two colors will fade into one another

Here are few more intro gits that can help you out:

  1. https://github.com/HeinrichReimer/material-intro
  2. https://github.com/PaoloRotolo/AppIntro
David
  • 37,109
  • 32
  • 120
  • 141
5

I found this library here:

CircleIndicator Library

It creates an Lollipop-like ViewPager with those circles. Just format the layout so that it's suitable for your app and then you should be fine. It doesn't contain an animation, but I think it's a start.

yannickpulver
  • 2,235
  • 1
  • 23
  • 31
2

You can use ViewPagerIndicator here: http://viewpagerindicator.com/#download. Then, you should define SharedPreferences, to show that ViewPager only once. You can write:

public class MainActivity extends Activity {
    public static final String MyPrefs = "MyPrefs";
    ...

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main);

        SharedPreferences sp = getSharedPreferences(MyPrefs, Context.MODE_PRIVATE);
        if (!sp.getBoolean("first", false)) {
            SharedPreferences.Editor editor = sp.edit();
            editor.putBoolean("first", true);
            editor.commit();
            Intent intent = new Intent(this, SampleCirclesDefault.class); //call your ViewPager class
            startActivity(intent);
        }
    }
}
linkas
  • 175
  • 5
  • 18
2

Maybe you would like to use one of Roman Nurik solutions: https://github.com/romannurik/Android-WizardPager

dniHze
  • 2,162
  • 16
  • 22
0

If you do not want to use a library, it is pretty simple. I used to use a library before, but I started implementing a custom version. All you have to do is use a tabbed view and view pager. Then design all these pages in the tutorial as fragments. These fragments can have any buttons, in any position, and different styling as you like because you are implementing each fragment yourself. And it is not difficult. In the end, just use shared preferences, to check if it is the first run. If it is how the activity which has all the fragments. Else do not show that activity.

Aman
  • 149
  • 13
  • If you don't want to use external library, you definitively should have a look to this tutorial : https://stackoverflow.com/questions/26954217/how-to-implement-first-launch-tutorial-like-android-lollipop-apps-like-sheets – Moussa Oct 16 '18 at 13:40