Giter Club home page Giter Club logo

appintro-1's Introduction

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

appintro-1's People

Contributors

jondouglas avatar

Watchers

 avatar  avatar  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.