Coder Social home page Coder Social logo

heinrichreimer / material-intro Goto Github PK

View Code? Open in Web Editor NEW
1.7K 48.0 308.0 23.86 MB

A simple material design app intro with cool animations and a fluent API.

Home Page: https://jitpack.io/#com.heinrichreimer/material-intro

License: MIT License

Java 100.00%
android android-library jitpack material-design java material animations material-components slides-featuring autoplay

material-intro's Introduction

Icon

material-intro

Build Status JitPack Downloads License GitHub issues

A simple material design app intro with cool animations and a fluent API.

Very inspired by Google's app intros.

Demo:

A demo app is available on Google Play:

Get it on Google Play

Screenshots:

Simple slide Custom slide Fade effect Permission request
Simple slide Custom slide Fade effect Permission request
SimpleSlide.java FragmentSlide.java IntroActivity.java SimpleSlide.java

Features:

  • Material design (check the docs)
  • Easy customization
  • Predefined slide layouts
  • Custom slides
  • Autoplay
  • Parallax slides
  • Fluent API

Table of Contents

  1. Setup
    1. Gradle Dependency
    2. Requirements
  2. Slides
    1. Standard slide
    2. Fragment slide
    3. Custom slide
  3. Customization
    1. Back button
    2. Next button
    3. CTA button
    4. Fullscreen
    5. Scroll duration
  4. Navigation
    1. Block navigation
    2. Navigate to slides
    3. Autoplay
    4. Callbacks
  5. Tips & Tricks
    1. Activity result
    2. Parallax slides
    3. Splash screens
  6. Apps using this library
  7. Changes
  8. Open-source libraries
  9. License

Setup:

Gradle Dependency:

material-intro is available on jitpack.io.

Add this in your root build.gradle file (not your module build.gradle file):

allprojects {
    repositories {
        maven { url 'https://jitpack.io' }
    }
}

Add this in your module build.gradle file:

dependencies {
    implementation 'com.heinrichreimersoftware:material-intro:x.y.z'
}

Requirements:

The activity must extend IntroActivity and have a theme extending @style/Theme.Intro:

public class MainIntroActivity extends IntroActivity {
    @Override 
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
	    // Add slides, edit configuration...
    }
}
<manifest ...>
    <application ...>
        <activity 
            android:name=".MainIntroActivity"
            android:theme="@style/Theme.Intro"/>
    </application>
</manifest>

(Unless mentioned otherwise, all of the following method calls should go in the Activity's onCreate().)

Slides:

material-intro has fluent style builders for both a simple text/image slide, as seen in Google's apps, and for slides featuring a custom Fragment or layout resource.

Feel free to submit an issue or pull request if you think any slide types are missing.

Standard slide (SimpleSlide):

Standard slide featuring a title, short description and image like Google's intros.

addSlide(new SimpleSlide.Builder()
        .title(R.string.title_1)
        .description(R.string.description_1)
        .image(R.drawable.image_1)
        .background(R.color.background_1)
        .backgroundDark(R.color.background_dark_1)
        .scrollable(false)
        .permission(Manifest.permission.CAMERA)
        .build());

Fragment slide (FragmentSlide):

Custom slide containing a Fragment or a layout resource.

addSlide(new FragmentSlide.Builder()
        .background(R.color.background_2)
        .backgroundDark(R.color.background_dark_2)
        .fragment(R.layout.fragment_2, R.style.FragmentTheme)
        .build());

(When using FragmentSlide with a Fragment, you should extend SlideFragment to proxy navigation calls to the intro activity.)

Custom slide (Slide):

Base slide. If you want to modify what's shown in your slide this is the way to go.

Customization:

Left ("back") button:

Control left button behavior or hide/show it.

/* Show/hide button */
setButtonBackVisible(true);
/* Use skip button behavior */
setButtonBackFunction(BUTTON_BACK_FUNCTION_SKIP);
/* Use back button behavior */
setButtonBackFunction(BUTTON_BACK_FUNCTION_BACK);

Right ("next") button:

Control right button behavior or hide/show it.

/* Show/hide button */
setButtonNextVisible(true);
/* Use next and finish button behavior */
setButtonNextFunction(BUTTON_NEXT_FUNCTION_NEXT_FINISH);
/* Use next button behavior */
setButtonNextFunction(BUTTON_NEXT_FUNCTION_NEXT);

CTA button:

Change the appearance of the "call to action" button:

/* Show/hide button */
setButtonCtaVisible(getStartedEnabled);
/* Tint button text */
setButtonCtaTintMode(BUTTON_CTA_TINT_MODE_TEXT);
/* Tint button background */
setButtonCtaTintMode(BUTTON_CTA_TINT_MODE_BACKGROUND);
/* Set custom CTA label */
setButtonCtaLabel(R.string.start)
/**/
setButtonCtaClickListener(new View.OnClickListener() {

});

Fullscreen:

Display the intro activity at fullscreen. This hides the status bar.

public class MainIntroActivity extends IntroActivity{
    @Override protected void onCreate(Bundle savedInstanceState){
        setFullscreen(true);
        super.onCreate(savedInstanceState);
	...
    }
}

Make sure to call setFullscreen() before calling super.onCreate()

Scroll duration:

Adjust how long a single slide scroll takes.

setPageScrollDuration(500);

(The page scroll duration is dynamically adapted when scrolling more than one position to reflect dynamic durations from the Material design docs. The exact formula for calculating the scroll duration is duration * (distance + sqrt(distance)) / 2.)

Navigation:

Block navigation:

There are three ways to block navigation for a slide:

  1. In a SlideFragment (using a FragmentSlide) by overriding canGoForward()/canGoBackward() methods.
  2. For a SimpleSlide by setting SimpleSlide.Builder#canGoForward(boolean)/SimpleSlide.Builder#canGoBackward(boolean). (If at least one permission is set to the SimpleSlide, navigation is automatically blocked until every permission is granted.)
  3. From your IntroActivity by setting a NavigationPolicy:
    setNavigationPolicy(new NavigationPolicy() {
        @Override public boolean canGoForward(int position) {
            return true;
        }
    
        @Override public boolean canGoBackward(int position) {
            return false;
        }
    });

Navigate to slides

Navigate through the intro manually using one of the following methods e.g. from a listeners callback. Each of them will respect blocked navigation settings.

/* Scroll to any position */
goToSlide(5);

/* Scroll to the next slide in the intro */
nextSlide();

/* Scroll to the previous slide in the intro */
previousSlide();

/* Scroll to the last slide of the intro */
goToLastSlide();

/* Scroll to the first slide of the intro */
goToFirstSlide();

Autoplay

Automatically scroll through the intro until user interacts with the intro.

/* Start an auto slideshow with 2500ms delay between scrolls and infinite repeats */
autoplay(2500, INFINITE);
/* Start an auto slideshow with default configuration  */
autoplay();
/* Cancel the slideshow */
cancelAutoplay()

Callbacks

If any of the above returns false when a user tries to navigate to a slide, a OnNavigationBlockedListener callback is fired that you can use to display a message. Additionally you can add plain-old ViewPager.OnPageChangeListeners to listen for page scrolls:

addOnNavigationBlockedListener(new OnNavigationBlockedListener() {
    @Override public void onNavigationBlocked(int position, int direction) { ... }
});

addOnPageChangeListener(new ViewPager.OnPageChangeListener(){
    @Override public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) { ... }
    @Override public void onPageSelected(int position) { ... }
    @Override public void onPageScrollStateChanged(int state) { ... }
});

Tips & Tricks:

Activity result:

You can check if the user canceled the intro (by pressing back) or finished it including all slides. Just call up the activity using startActivityForResult(intent, REQUEST_CODE_INTRO); and then listen for the result:

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);
    if (requestCode == REQUEST_CODE_INTRO) {
        if (resultCode == RESULT_OK) {
            // Finished the intro
        } else {
            // Cancelled the intro. You can then e.g. finish this activity too.
            finish();
	}
    }
}

Parallax slides:

You can easily achieve a nice looking parallax effect for any slide by using either ParallaxFrameLayout.java, ParallaxLinearLayout.java or ParallaxRelativeLayout.java and defining layout_parallaxFactor for its direct childrens. A higher factor means a stronger parallax effect, 0 means no parallax effect at all.

<com.heinrichreimersoftware.materialintro.view.parallax.ParallaxLinearLayout
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    ... >

    <TextView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_parallaxFactor="0"
        ... />

    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        app:layout_parallaxFactor="1.25"
        ... />

</com.heinrichreimersoftware.materialintro.view.parallax.ParallaxLinearLayout>

Check the "Canteen"-demo for a layout example.

Splash screens:

If you want to show the intro only at the first app start you can use onActivityResult() to store a shared preference when the user finished the intro.

See the demo app for a sample splash screen implementation:

Apps using this library:

Changes:

See the releases section for changelogs.

Open-source libraries:

material-intro uses the following open-source files:

License:

MIT License

Copyright (c) 2017 Jan Heinrich Reimer

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

material-intro's People

Contributors

adrcotfas avatar bkromhout avatar chihung93 avatar chimbori avatar daniel-stoneuk avatar dependabot[bot] avatar firefinchdev avatar heinrichreimer avatar iampkhan avatar ijens1 avatar jlnstrk avatar joeykrim avatar jucedik avatar maxr1998 avatar meierjan avatar mflisar avatar ntcho avatar odin- avatar petnagy avatar pinpong avatar ritu99 avatar schneiderl avatar shaishavgandhi avatar spongebobsun avatar thakkaryash94 avatar thedorkknightrises avatar tiocomegfas avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

material-intro's Issues

Next button arrow icon not visible until reached last slide

Hey,

I'm using the compile 'com.heinrichreimersoftware:material-intro:-SNAPSHOT' with skip button disabled. And when the material-intro starts, the arrow icon of the next button is invisible. But if I go to the last slide and navigate backwards then the next button arrow icon is visible.

java.lang.IndexOutOfBoundsException occurs on Samsung S Advance

I have a problem on the mentioned device with the library. If I click fast enough on the Next button, I get the following exception:

5-19 12:38:41.079 5416-5416/com.frontendart.qualitygate.android E/AndroidRuntime: FATAL EXCEPTION: main java.lang.IndexOutOfBoundsException: Invalid index 6, size is 6 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:251) at java.util.ArrayList.get(ArrayList.java:304) at com.heinrichreimersoftware.materialintro.slide.SlideAdapter.getSlide(SlideAdapter.java:66) at com.heinrichreimersoftware.materialintro.app.IntroActivity.getSlide(IntroActivity.java:504) at com.heinrichreimersoftware.materialintro.app.IntroActivity.canGoForward(IntroActivity.java:195) at com.heinrichreimersoftware.materialintro.app.IntroActivity.nextSlide(IntroActivity.java:160) at com.heinrichreimersoftware.materialintro.app.IntroActivity$2.onClick(IntroActivity.java:144) at android.view.View.performClick(View.java:4162) at android.view.View$PerformClick.run(View.java:17082) at android.os.Handler.handleCallback(Handler.java:615) at android.os.Handler.dispatchMessage(Handler.java:92) at android.os.Looper.loop(Looper.java:137) at android.app.ActivityThread.main(ActivityThread.java:4856) at java.lang.reflect.Method.invokeNative(Native Method) at java.lang.reflect.Method.invoke(Method.java:511) at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1007) at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:774) at dalvik.system.NativeStart.main(Native Method)

The intro screen also hangs for a bit (that must be because it loads some data in the background), so I can click on Next button quite a few times, and nothing happens, except for this exception suddenly.

Opening a new Activity after last slide

Although a similar issue already exists, it is closed. Hence the new issue.

It would be nice, if a sample code is provided for starting a new activity (after the last slide) by overriding the onDestroy()

Regards

Navigation buttons

Hi there,

great library!!

Would it be possible to change the "skip" button to a "previous" button. Further, if possible, it'd be great if the "previous" button would hide on the first slide and the "next" button hide on the last slide.

My intention is to use this library more as a presentation/guide (i my case a guidance on how to perform first aid).

Cheers and thanks in advance!

Set indicator dot colors and button colors based on background color

We should set the grey dot color always the color of the status bar and change the white dot color to grey similar to the way the status bar switches between light mode/dark mode based on the luminance of the background.
That would make it easier for devs implementing material-intro to rely on readability without having to deal with foreground colors at all.

Possible fix for #37

License file: Mention 3rd-party dependencies

For clarification, I'd recommend adding the 3rd-party dependenices to License.txt. This would be quite useful when crediting dependencies in ones app. Then one could simply copy the contents of License.txt instead of adding the 3rd-party dependencies manually.

Example:

Copyright 2016 Heinrich Reimer

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

   http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

This project uses the following 3rd-party dependencies which are licensed under the Apache License as well:

- a
- b
- c


Long copy of the Apache License.

Parallax effect (Feature request)

Hi, I'd like to request a new feature where we can have a parallax effect while sliding between fragments like this:
ezgif com-resize
Because it's such a nice effect to have this haha

More slide types

This issue should track progress of more slide types.

Current slide types:

  • SimpleSlide: Standard slide featuring a title, short description and image like Google's intros.
  • FragmentSlide: Custom slide containing a Fragment or a layout resource.
  • Slide: Base slide. If you want to modify what's shown in your slide this is the way to go.

Ideas:

  • ParallaxSlide: Slide that has multiple layers and creates a nice parallax effect.

Screen rotation resets intro slides in splash screen demo

Whenever I rotate the screen during the intro slides, the intro starts again at the initial position. I follow the example code and add my slides in onCreate(). I tried to wrap the code into a
if (null == savedInstanceState) { ... }, but then I get an exception:

java.lang.IndexOutOfBoundsException: Invalid index 2, size is 0
 android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2689)
 android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2754)
 android.app.ActivityThread.handleRelaunchActivity(ActivityThread.java:4458)
 android.app.ActivityThread.access$1000(ActivityThread.java:177)
 android.app.ActivityThread$H.handleMessage(ActivityThread.java:1454)
 android.os.Handler.dispatchMessage(Handler.java:102)
 android.os.Looper.loop(Looper.java:145)
 android.app.ActivityThread.main(ActivityThread.java:5938)
 java.lang.reflect.Method.invoke(Native Method)
 java.lang.reflect.Method.invoke(Method.java:372)
 com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
 com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
by: java.lang.IndexOutOfBoundsException: Invalid index 2, size is 0
 java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255)
 java.util.ArrayList.get(ArrayList.java:308)
 com.heinrichreimersoftware.materialintro.slide.SlideAdapter.getBackground(SlideAdapter.java:93)
 com.heinrichreimersoftware.materialintro.app.IntroActivity.getBackground(IntroActivity.java:752)
 com.heinrichreimersoftware.materialintro.app.IntroActivity.updateBackground(IntroActivity.java:367)
 com.heinrichreimersoftware.materialintro.app.IntroActivity.onPostCreate(IntroActivity.java:125)

Splash screen demo

There should be a demo on how to start the intro for the first run and with a splash screen.

FATAL EXCEPTION on API level 19

Hi,
I get a fatal exception on a Samsung GT-I995 / API level 19, version 4.4.2 when pressing the skip button or sliding to the end.

05-27 20:40:55.530 27093-27093/com.heinrichreimersoftware.materialintro.demo E/AndroidRuntime: FATAL EXCEPTION: main Process: com.heinrichreimersoftware.materialintro.demo, PID: 27093 java.lang.ArrayIndexOutOfBoundsException: length=7; index=7 at com.heinrichreimersoftware.materialintro.view.InkPageIndicator.setSelectedPage(InkPageIndicator.java:617) at com.heinrichreimersoftware.materialintro.view.InkPageIndicator.onPageSelected(InkPageIndicator.java:226) at com.heinrichreimersoftware.materialintro.view.FadeableViewPager$OnPageChangeListenerWrapper.onPageSelected(FadeableViewPager.java:74) at android.support.v4.view.ViewPager.dispatchOnPageSelected(ViewPager.java:1852) at android.support.v4.view.ViewPager.scrollToItem(ViewPager.java:625) at android.support.v4.view.ViewPager.setCurrentItemInternal(ViewPager.java:609) at android.support.v4.view.ViewPager.onTouchEvent(ViewPager.java:2164) at com.heinrichreimersoftware.materialintro.view.SwipeBlockableViewPager.onTouchEvent(SwipeBlockableViewPager.java:63) at android.view.View.dispatchTouchEvent(View.java:8135) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2425) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2149) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2164) at android.view.ViewGroup.dispatchTransformedTouchEvent(ViewGroup.java:2431) at android.view.ViewGroup.dispatchTouchEvent(ViewGroup.java:2164) at com.android.internal.policy.impl.PhoneWindow$DecorView.superDispatchTouchEvent(PhoneWindow.java:2295) at com.android.internal.policy.impl.PhoneWindow.superDispatchTouchEvent(PhoneWindow.java:1622) at android.app.Activity.dispatchTouchEvent(Activity.java:2565) at android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent(WindowCallbackWrapper.java:60) at com.android.internal.policy.impl.PhoneWindow$DecorView.dispatchTouchEvent(PhoneWindow.java:2243) at android.view.View.dispatchPointerEvent(View.java:8343) at android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent(ViewRootImpl.java:4769) at android.view.ViewRootImpl$ViewPostImeInputStage.onProcess(ViewRootImpl.java:4635) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4193) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4247) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4216) at android.view.ViewRootImpl$AsyncInputStage.forward(ViewRootImpl.java:4327) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4224) at android.view.ViewRootImpl$AsyncInputStage.apply(ViewRootImpl.java:4384) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4193) at android.view.ViewRootImpl$InputStage.onDeliverToNext(ViewRootImpl.java:4247) at android.view.ViewRootImpl$InputStage.forward(ViewRootImpl.java:4216) at android.view.ViewRootImpl$InputStage.apply(ViewRootImpl.java:4224) at android.view.ViewRootImpl$InputStage.deliver(ViewRootImpl.java:4193) at android.view.ViewRootImpl.deliverInputEvent(ViewRootImpl.java:6567) at android.view.ViewRootImpl.doProcessInputEvents(ViewRootImpl.java:6484) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6455) at android.view.ViewRootImpl.enqueueInputEvent(ViewRootImpl.java:6420) at android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent(ViewRootImpl.java:6647) at android.view.InputEventReceiver.dispatchInputEvent(InputEventReceiver.java:185) at android.os.MessageQueue.nativePollOnce(Native Method)

Next button does not work after screen rotation

I experienced an issue with the Next button. The steps to reproduce are the following:

  1. Start the Intro activity with Previous and Next buttons enabled
  2. Rotate the screen
  3. Rotate the screen back to original position
  4. The Next button does not work anymore (but the Previous does)

The screen orientation order was portrait -> landscape -> portrait, but I'm pretty sure it is also reproducable starting from landscape.
I encountered this problem on a number of devices:

  • Samsung Galaxy Ace 2 @ Android 4.4.4 and 4.1.2
  • Samsung Note 3 @ Android 5.0
  • Samsung S Advance @ Android 4.1.2
  • Nexus 7 @ Android 6.0.1

There should be a way to know when the finish button is pressed

It would be really useful to know when the finish button is pressed. Right now the only way to know is overriding nextSlide but it doesn't work for all cases. It could be a callback or a public method that the user can override, maybe just change the signature of finishIfNeeded to public? That would be really helpful.

IndexOutOfBoundsException when scrolling to the end of the intro

Hello,

Here's another fatal exception while scrolling to the end of the intro activity. I'm using the latest 1.5.1 version.

FATAL EXCEPTION: main Process: com.apps.adrcotfas.goodtime, PID: 13438 java.lang.IndexOutOfBoundsException: Invalid index 3, size is 3 at java.util.ArrayList.throwIndexOutOfBoundsException(ArrayList.java:255) at java.util.ArrayList.get(ArrayList.java:308) at com.heinrichreimersoftware.materialintro.slide.SlideAdapter.getSlide(SlideAdapter.java:69) at com.heinrichreimersoftware.materialintro.app.IntroActivity.getSlide(IntroActivity.java:756) at com.heinrichreimersoftware.materialintro.app.IntroActivity.updateParallax(IntroActivity.java:568) at com.heinrichreimersoftware.materialintro.app.IntroActivity.access$700(IntroActivity.java:52) at com.heinrichreimersoftware.materialintro.app.IntroActivity$IntroPageChangeListener.onPageScrolled(IntroActivity.java:854) at com.heinrichreimersoftware.materialintro.view.FadeableViewPager$OnPageChangeListenerWrapper.onPageScrolled(FadeableViewPager.java:66)

Validation feature

Would be nice to have the ability to block users from getting past a given page based on some sort of policy:

public interface PageContinuePolicy{
    boolean canGoToPage(int oldPosition, int newPosition);
}

That way we could also check for permissions and such. You could also disallow users to go back.

Update Gradle dependency

You should probably update ur gradle library., because setSkipEnabled(skipEnabled) and setFinishEnabled(finishEnabled) aren't working when using gradle.

Use CoordinatorLayout instead of FrameLayout for Material powa

In /res/layout/activity_intro.xml the library uses a FrameLayout as main element. However this prevents us from achieving all the Material's goodness. For example as in your demo app, when showing a Snackbar the Fabs and the InkIndicator doesn't move with the Snackbar, and they get behind it.
Would it be possible to use a CoordinatorLayout instead of a FrameLayout to achive such advantages?

Thanks.

Permission Slide does not block navigation correctly

I've added 4 slides with the last one requiring a permission to continue. If skip is pressed from the first slide the activity finishes and is not blocked. Is this the expected behavior? However if I first switch to the permission slide and back to the first slide, press skip the block occurs correctly. I've attached a video of the demo app to illustrate.
ezgif com-resize 1

NullPointerException: Attempt to invoke virtual method 'void FadeableViewPager.setAdapter(PagerAdapter)' on a null object reference

`Caused by: java.lang.NullPointerException: Attempt to invoke virtual method 'void com.heinrichreimersoftware.materialintro.view.FadeableViewPager.setAdapter(android.support.v4.view.PagerAdapter)' on a null object reference
at com.heinrichreimersoftware.materialintro.app.IntroActivity.findViews(IntroActivity.java:154)
at com.heinrichreimersoftware.materialintro.app.IntroActivity.onCreate(IntroActivity.java:81)
at com.rhostudiomx.yuqim.MaterialIntroActivity.onCreate(MaterialIntroActivity.java:43)
at android.app.Activity.performCreate(Activity.java:6237)
at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1107)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2369)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2476) 
at android.app.ActivityThread.-wrap11(ActivityThread.java) 
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344) 
at android.os.Handler.dispatchMessage(Handler.java:102) 
at android.os.Looper.loop(Looper.java:148) 
at android.app.ActivityThread.main(ActivityThread.java:5417) 
at java.lang.reflect.Method.invoke(Native Method) 
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726) 
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616) 
``

Navigation Bar Color

Allow to change the navigation bar color like the backgroundDarkColor.

For Example:
.background(R.color.example1)
.backgroundDark(R.color.example2)
.backgroundNavigationBar(R.color.example3)
.build());

Bug: ArrayIndexOutOfBoundsException when clicking skip button

java.lang.ArrayIndexOutOfBoundsException: length=2; index=2
at com.heinrichreimersoftware.materialintro.view.InkPageIndicator.setCurrentPageImmediate(InkPageIndicator.java:232)
at com.heinrichreimersoftware.materialintro.view.InkPageIndicator.calculateDotPositions(InkPageIndicator.java:222)
at com.heinrichreimersoftware.materialintro.view.InkPageIndicator.onMeasure(InkPageIndicator.java:277)
at android.view.View.layout(View.java:16617)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutHorizontal(LinearLayout.java:1732)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1497)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.LinearLayout.setChildFrame(LinearLayout.java:1743)
at android.widget.LinearLayout.layoutVertical(LinearLayout.java:1586)
at android.widget.LinearLayout.onLayout(LinearLayout.java:1495)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:336)
at android.widget.FrameLayout.onLayout(FrameLayout.java:273)
at com.android.internal.policy.PhoneWindow$DecorView.onLayout(PhoneWindow.java:2678)
at android.view.View.layout(View.java:16630)
at android.view.ViewGroup.layout(ViewGroup.java:5437)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2171)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1931)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1107)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6013)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:858)
at android.view.Choreographer.doCallbacks(Choreographer.java:670)
at android.view.Choreographer.doFrame(Choreographer.java:606)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:844)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)

Add option to completely hide skip and finish buttons

how can i hide skip and finish button ???

i want to hide it in all pages .....

i tried
/* Enable/disable skip button */
setSkipEnabled(false);

    /* Enable/disable finish button */
    setFinishEnabled(false);

i think its not working ,, it visible but not enable

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.