All Projects → rubengees → Introduction

rubengees / Introduction

Licence: mit
An Android library to show an intro to your users.

Programming Languages

java
68154 projects - #9 most used programming language

Projects that are alternatives of or similar to Introduction

openui5-tour
OpenUI5 Tour enables an user-friendly way to showcase products and features in your website.
Stars: ✭ 21 (-95.54%)
Mutual labels:  tour, intro
Dynamic Support
A complete library to build Android apps with a built-in theme engine.
Stars: ✭ 218 (-53.72%)
Mutual labels:  library, intro
Reactour
Tourist Guide into your React Components
Stars: ✭ 2,782 (+490.66%)
Mutual labels:  intro, tour
Showcaseview
🔦The ShowcaseView library is designed to highlight and showcase specific parts of apps to the user with an attractive and flat overlay.
Stars: ✭ 281 (-40.34%)
Mutual labels:  intro, tour
React Native Vision Camera
📸 The Camera library that sees the vision.
Stars: ✭ 443 (-5.94%)
Mutual labels:  library
Pyrlang
Erlang node implemented in Python 3.5+ (Asyncio-based)
Stars: ✭ 436 (-7.43%)
Mutual labels:  library
React Native Blurhash
🖼️ A library to show colorful blurry placeholders while your content loads.
Stars: ✭ 430 (-8.7%)
Mutual labels:  library
Create React Library
⚡CLI for creating reusable react libraries.
Stars: ✭ 4,554 (+866.88%)
Mutual labels:  library
Rubberpicker
Android Rubber Picker Library
Stars: ✭ 469 (-0.42%)
Mutual labels:  library
Flutter Intro Slider
Simple and configurable app introduction slider for Flutter
Stars: ✭ 461 (-2.12%)
Mutual labels:  intro
Curl
A command line tool and library for transferring data with URL syntax, supporting DICT, FILE, FTP, FTPS, GOPHER, GOPHERS, HTTP, HTTPS, IMAP, IMAPS, LDAP, LDAPS, MQTT, POP3, POP3S, RTMP, RTMPS, RTSP, SCP, SFTP, SMB, SMBS, SMTP, SMTPS, TELNET and TFTP. libcurl offers a myriad of powerful features
Stars: ✭ 22,875 (+4756.69%)
Mutual labels:  library
Candybar Library
Android icon pack material dashboard
Stars: ✭ 437 (-7.22%)
Mutual labels:  library
Chat Api
WhatsApp's Private API
Stars: ✭ 4,251 (+802.55%)
Mutual labels:  library
Android Dev Sources
All those Android development sources that you need to be and stay awesome!
Stars: ✭ 434 (-7.86%)
Mutual labels:  library
Sleepy Discord
C++ library for the Discord chat client
Stars: ✭ 459 (-2.55%)
Mutual labels:  library
Globjects
C++ library strictly wrapping OpenGL objects.
Stars: ✭ 431 (-8.49%)
Mutual labels:  library
Ivi
🔥 Javascript (TypeScript) library for building web user interfaces
Stars: ✭ 445 (-5.52%)
Mutual labels:  library
Compiler
The Hoa\Compiler library.
Stars: ✭ 458 (-2.76%)
Mutual labels:  library
Cordova Plugin Whitelist
Apache Cordova plugin whitelist
Stars: ✭ 442 (-6.16%)
Mutual labels:  library
Ponder
C++ reflection library with Lua binding, and JSON and XML serialisation.
Stars: ✭ 442 (-6.16%)
Mutual labels:  library

Introduction Download API CircleCI

Show a beautiful Intro to your users with ease.

You can download the latest sample app here.

Table of contents

Include in your Project

Add this to your root build.gradle (usually in the root of your project):

repositories {
    maven { url "https://jitpack.io" }
}

And this to your module build.gradle (usually in the app directory):

dependencies {
    implementation 'com.github.rubengees:introduction:2.0.0'
}

If that doesn't work, look if there is a new version and the Readme was not updated yet.

If you want to use asynchronous image loading, introduced in the new version 1.1.0, you will need Glide or some other image loading library. If you want to use GIFs you will also need it.

Usage

Create an IntroductionBuilder like the following:

new IntroductionBuilder(this) // this is the Activity you want to start from.

Then add some Slides to your Introduction:

new IntroductionBuilder(this).withSlides(generateSlides())
private List<Slide> generateSlides() {
    List<Slide> result = new ArrayList<>();

    result.add(new Slide()
            .withTitle("Some title")
            .withDescription("Some description")
            .withColorResource(R.color.green)
            .withImage(R.drawable.myImage)
    );

    result.add(new Slide()
            .withTitle("Another title")
            .withDescription("Another description")
            .withColorResource(R.color.indigo)
            .withImage(R.drawable.myImage2)
    );

    return result;
}

Finally introduce yourself!

new IntroductionBuilder(this).withSlides(generateSlides()).introduceMyself();

That was easy right?

You can do many customizations, which will be covered by the following.

Options

You can let the user make decisions, which you can use like settings. To do that you add an Option to your slide:

new Slide().withTitle("Feature is doing something")
          .withOption(new Option("Enable the feature"))
          .withColorResource(R.color.orange)
          .withImage(R.drawable.image));

When the user completes the intro, you will receive the selected Options in onActivityResult. To read the result:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
     if (requestCode == IntroductionBuilder.INTRODUCTION_REQUEST_CODE && resultCode == RESULT_OK) {
         String result = "User chose: ";

         for (Option option : data.<Option>getParcelableArrayListExtra(IntroductionActivity.OPTION_RESULT)) {
            result += option.getPosition() + (option.isActivated() ? " enabled" : " disabled");
        }
     }
}

The constant value of the request is 32142, so don't use that yourself. It is possible that the user cancels the intro. If that happens, the resultCode is RESULT_CANCELLED and no Options are passed back.

Use Gifs as images

This library supports GIFs. You need to load them asynchronously as the loading may take a while:

new IntroductionBuilder(this)
        .withSlides(slides)
        .withOnSlideListener(new OnSlideListener() {
            @Override
            public void onSlideInit(int position, @Nullable TextView title, @NonNull ImageView image,
                                    @Nullable TextView description) {
                if (position == 1) { // Assume we want to load the GIF at Slide 2 (index 1).
                    Glide.with(image.getContext())
                            .load(R.drawable.image3)
                            .into(image);
                }
            }
        }).introduceMyself();

This will add the GIF, which will be automatically played when the users navigates to the Slide.

Runtime Permissions

Android Marshmallow introduced Runtime Permissions, which can be requested easily with this lib. To do that, you can add a global listener like the following:

new IntroductionBuilder(this)
        .withSlides(slides)
        .withOnSlideListener(new OnSlideListener() {
            @Override
            public void onSlideChanged(int from, int to) {
                if (from == 0 && to == 1) {
                    if (ActivityCompat.checkSelfPermission(MainActivity.this,
                            Manifest.permission.WRITE_EXTERNAL_STORAGE) != PackageManager.PERMISSION_GRANTED) {
                        ActivityCompat.requestPermissions(MainActivity.this,
                                new String[]{Manifest.permission.WRITE_EXTERNAL_STORAGE}, 12);
                    }
                }
            }
        }).introduceMyself();

You can check if the permissions were granted like the following:

@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions,
                                       @NonNull int[] grantResults) {
    super.onRequestPermissionsResult(requestCode, permissions, grantResults);

    if (requestCode == 12) {
        if (grantResults[0] == PackageManager.PERMISSION_GRANTED) {
            Toast.makeText(this, "Permission was successfully granted!", Toast.LENGTH_LONG).show();
        }
    }
}

You can use that listener for different things too, of course!

Styles

There are two available styles: Translucent and Fullscreen. To apply one of those styles, do the following:

new IntroductionBuilder(this)
                .withSlides(generateSlides())
                .withStyle(new FullscreenStyle())
                .introduceMyself();

Translucent is the default style.

Custom Views

You can supply your own View to a Slide instead of just setting the title, image and description.
This is done like follows:

Create a class which implements CustomViewBuilder:

public class CustomViewBuilderImpl implements Slide.CustomViewBuilder {

    @NonNull
    @Override
    public View buildView(@NonNull LayoutInflater inflater, @NonNull ViewGroup parent) {
        return inflater.inflate(R.layout.layout_custom, parent, false);
    }
}

Then set it to your Slide:

new IntroductionBuilder(this)
        .withSlides(new Slide()
                .withCustomViewBuilder(new CustomViewBuilderImpl())
                .withColorResource(R.color.cyan)
        ).introduceMyself();

If you set a CustomViewBuilder to your Slide, all other values aside from the color are overridden. You have to manage all on your own.

Further reading

A much more detailed explanation with all available APIs can be found in the Wiki.
Detailed Javadoc can be found here.

Upgrade Guide

1.4.0+ to 2.0.0+

  • This library now requires Java 8 (available in the new Android Studio 3 toolchain).
  • Behaviour change: Not passing a title, description or option hides the respective views. This way you can show fullscreen images.
    • The title and description parameters of the onSlideInit callback are now @Nullable
  • CustomViewBuilder is now in a different package and has been converted into an interface.

1.3.9 to 1.4.0+

  • Slide and Option have been moved into a different package. Just let Android Studio re-import them.
  • The OnSlideListener is now an interface on its own. Remove IntroductionConfig before each and let Android Studio re-import. Furthermore @NotNull annotations have been added; You should add them to the signature.

1.1.0 to 1.1.1+

  • The OnSlideInit method in the OnSlideListener now comes without the Fragment context. If you need a Context, call image.getContext().
  • There is now a class for Styles instead of an Integer. If you apply no Style, you have to do nothing, if you use one, change it to the following e.g.: .withStyle(new FullscreenStyle()).

1.0.x to 1.1.0+

  • The OnSlideChangedListener was renamed to OnSlideListener. Just rename it and it's working again.
  • Asynchronous image loading is now available (and recommended!). See the Use GIFs as drawables section for more info. It applies for all types of images. GIFs won't work without asynchronous loading from now on!

Metrics


Contributions and contributors

A guide for contribution can be found here.

  • @Akeshihiro for proper licencing and a small Gradle related adjustment.
  • @cafedeaqua for a small code improvement

Acknowledgments

The images in the samples are taken from the following webpages (I do not own any of the images, all rights are reserved to their respective owners):

Some images and ideas are from this Repo: AppIntro by Paolo Rotolo

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].