AppIntro: Unable to swipe between slides

AppIntro Version: 4.1.0

Device/Android Version: every device I have tried (e.g. Samsung Galaxy S5mini, LG H440N, any in emulator)

Issue details / Repro steps / Use case background: In intro with permissions it is necessary to use e.g. android.Manifest.permission.ACCESS_FINE_LOCATION instead of Manifest.permission.ACCESS_FINE_LOCATION

But adding android causes that I can’t swipe between slides. When android is removed, i can swipe but than it can’t resolve symbol ACCESS_FINE_LOCATION.

This bad behavior is also in example project AppIntroExample on Google Play.

About this issue

  • Original URL
  • State: closed
  • Created 8 years ago
  • Reactions: 1
  • Comments: 34 (15 by maintainers)

Most upvoted comments

Hey @voghDev! It’s not too late. I didn’t had much time to update AppIntro recently.

Let’s see if we can fix this at library level. I don’t think the user should be the one responsible to make that setSwipeLock call.

P.S. Also kudos for using Kotlin! 😉

And as reference - this is my complete App Intro Activity:

public class TutorialActivity extends AppIntro2 {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);

        addSlide(AppIntro2Fragment.newInstance(getString(R.string.tutorial_page_1_title), getString(R.string.tutorial_page_1_description), R.drawable.placeholder, ContextCompat.getColor(this, R.color.tutorialPage1)));
        addSlide(AppIntro2Fragment.newInstance(getString(R.string.tutorial_page_2_title), getString(R.string.tutorial_page_2_description), R.drawable.placeholder, ContextCompat.getColor(this, R.color.tutorialPage2)));
        addSlide(PermissionAppIntroFragment.newInstance(getString(R.string.tutorial_page_3_title), getString(R.string.tutorial_page_3_description), R.drawable.placeholder, ContextCompat.getColor(this, R.color.tutorialPage3)));
        addSlide(AppIntro2Fragment.newInstance(getString(R.string.tutorial_page_4_title), getString(R.string.tutorial_page_4_description), R.drawable.placeholder, ContextCompat.getColor(this, R.color.tutorialPage4)));

        showSkipButton(false);

        setColorTransitionsEnabled(true);

    }

    @Override
    public void onDonePressed(Fragment currentFragment) {
        super.onDonePressed(currentFragment);

   
    }
}

This is the source of the bug: https://github.com/paolorotolo/AppIntro/blob/master/library/src/main/java/com/github/paolorotolo/appintro/AppIntroBase.java#L804

public void askForPermissions(String[] permissions, int slidesNumber) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
        if (slidesNumber == 0) {
            Toast.makeText(getBaseContext(), "Invalid Slide Number", Toast.LENGTH_SHORT).show();
        } else {
            PermissionObject permission = new PermissionObject(permissions, slidesNumber);
            permissionsArray.add(permission);
            setSwipeLock(true);
        }
    }
}

On M+ devices swiping gets disabled if we need to ask the user for permission

Solved by #654

Label all the things 😛

I can confirm this issue. Adding a permission to the onboarding in Android 6.0 and higher disables the swiping

Thanks for this great library! It saved me a lot of work 😄