Skip to content

JonDouglas/AppIntro

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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.

Usage

Basic usage

Add this project to your Xamarin.Android solution!

Or download from NuGet:

https://www.nuget.org/packages/AppIntro/1.0.0

Create a new Activity that extends AppIntro:

 [Activity(Theme = "@style/FullscreenTheme")]
    public class DefaultIntro : AppIntro
    {
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            AddSlide(SampleSlide.NewInstance(Resource.Layout.intro));
            AddSlide(SampleSlide.NewInstance(Resource.Layout.intro2));
            AddSlide(SampleSlide.NewInstance(Resource.Layout.intro3));
            AddSlide(SampleSlide.NewInstance(Resource.Layout.intro4));
        }

        public void GetStarted(View v)
        {
            LoadMainActivity();
        }

        public override void OnDonePressed()
        {
            base.OnDonePressed();

            LoadMainActivity();
        }

        public override void OnSkipPressed(Fragment currentFragment)
        {
            base.OnSkipPressed();
            LoadMainActivity();
            Toast.MakeText(ApplicationContext, Resource.String.skip, ToastLength.Short).Show();
        }
    }

Note above that we DID NOT use SetContentView();

Finally, declare the activity in your Manifest like so:

 [Activity(Theme = "@style/FullscreenTheme")]

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.

Alternative layout

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

public class IntroActivity : AppIntro2 
{
    // ...
}


Slides

Basic slides

AppIntro provides two simple classes, AppIntroFragment and AppIntro2Fragment which one can use to build simple slides.

protected override void OnCreate(Bundle savedInstanceState)
{
    // ...

    AddSlide(AppIntroFragment.NewInstance(title, description, image, backgroundColor));
}
Custom slides example

One may also define custom slides as seen in the example project:

  • Copy the class SampleSlide from my example project.
  • Add a new slide with addSlide(SampleSlide.newInstance(R.layout.your_slide_here));

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

Extended usage

See the readme on the original project for more information:

https://github.com/PaoloRotolo/AppIntro#extended-usage

Releases

No releases published

Packages

No packages published

Languages