Skip to content
This repository has been archived by the owner on Dec 26, 2018. It is now read-only.

Inspired by Heinrich Reimer Material Intro and developed with love from scratch

License

Notifications You must be signed in to change notification settings

gxcare/material-intro-screen

 
 

Repository files navigation

Android Material Intro Screen

Material intro screen is inspired by Material Intro and developed with love from scratch. I decided to rewrite completely almost all features in order to make Android intro screen easy to use for everyone and extensible as possible.

This version has been modified and improved for my purposes.

Features

Simple slide Custom slide Permission slide Finish slide
Simple slide Customslide Permission slide Finish slide

Usage

Step 1:

Add gradle dependecy

dependencies {
  compile 'agency.tango.android:material-intro-screen:{latest_release}'
}

Step 2:

First, your intro activity class needs to extend MaterialIntroActivity:

public class IntroActivity extends MaterialIntroActivity

Step 3:

Add activity to manifest with defined theme:

        <activity
            android:name=".IntroActivity"
            android:theme="@style/Theme.MaterialIntro" />

Step 4:

 @Override
    protected void onCreate(@Nullable Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        
        addSlide(new SlideFragmentBuilder()
                .backgroundColor(R.color.colorPrimary)
                .buttonsColor(R.color.colorAccent)
                .possiblePermissions(new String[]{Manifest.permission.CALL_PHONE, Manifest.permission.READ_SMS})
                .neededPermissions(new String[]{Manifest.permission.CAMERA, Manifest.permission.ACCESS_FINE_LOCATION, Manifest.permission.ACCESS_COARSE_LOCATION})
                .image(introscreen.R.drawable.ic_next)
                .grantPermissionMessage(R.string.txt_pls_grant_permission)
                .grantPermissionError(R.string.txt_grant_permission_error)
                .title("title 3")
                .description("Description 3")
                .build(),
              new MessageButtonBehaviour(new MessageButtonClickListener() {
                  @Override
                  public void onClick(Button messageButton) {
                      messageButton.setText("Click me once again!");
                      showMessage("We provide solutions to make you love your work");
                  }
              }, "Work with love"));
}

Explanation of SlideFragment usage:

  • possiblePermissions ⇾ permissions which are not necessary to be granted
  • neededPersmissions ⇾ permission which are needed to be granted to move further from that slide
  • MessageButtonBehaviour ⇾ create a new instance only if you want to have a custom action or text on a message button

Step 5:

Customize Intro Activity:

  • setSkipButtonVisible() ⇾ show skip button instead of back button on the left bottom of screen
  • hideBackButton() ⇾ hides any button on the left bottom of screen
  • enableLastSlideAlphaExitTransition() ⇾ set if the last slide should disapear with alpha hiding effect
  • onLastSlidePassed ⇾ Override in order to perform some action after passing last slide

Customizing view animations:

You can set enter, default and exit translation for every view in intro activity. To achive this you need to get translation wrapper for chosen view (for example: getNextButtonTranslationWrapper()) and set there new class which will implement IViewTranslation

getBackButtonTranslationWrapper()
                .setEnterTranslation(new IViewTranslation() {
                    @Override
                    public void translate(View view, @FloatRange(from = 0, to = 1.0) float percentage) {
                        view.setAlpha(percentage);
                    }
                });
  • getNextButtonTranslationWrapper()
  • getBackButtonTranslationWrapper()
  • getPageIndicatorTranslationWrapper()
  • getViewPagerTranslationWrapper()
  • getSkipButtonTranslationWrapper()

Custom slides

Of course you are able to implement completely custom slides. You only need to extend SlideFragmentBase and override all needed by you functions.

  • backgroundColor()
  • buttonsColor()
  • canMoveFurther() (only if you want to stop user from being able to move further before he will do some action)
  • cantMoveFurtherErrorMessage() (as above)
  • neededPermissions()
  • possiblePermissions()
  • grantPermissionStringRes()
  • grantPermissionErrorStringRes()

If you want to use parallax in a fragment please use one of the below views:

And set there the app:mis_layout_parallaxFactor attribute:

<introscreen.parallax.ParallaxLinearLayout
xmlns:android="http://schemas.android.com/apk/res/android">

    <ImageView
        android:id="@+id/image_slide"
        app:mis_layout_parallaxFactor="0.6"/>

All features which are not available in simple Slide Fragment are shown here: Custom Slide

Things I have used to create this

Getting Help

To report a specific problem or feature request, open a new issue on Github.

Company

Facebook     Twitter     LinkedIn

Here you can see open source work developed by Tango Agency.

Whether you're searching for a new partner or trusted team for creating your new great product we are always ready to start work with you.

You can contact us via contact@tango.agency. Thanks in advance.

About

Inspired by Heinrich Reimer Material Intro and developed with love from scratch

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Java 100.0%