Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to know tour is closed/complete #62

Open
Ankur008 opened this issue Jun 28, 2017 · 3 comments
Open

How to know tour is closed/complete #62

Ankur008 opened this issue Jun 28, 2017 · 3 comments

Comments

@Ankur008
Copy link

Ankur008 commented Jun 28, 2017

I want to run a function when the tour is complete. How would I do it?

@zacharee
Copy link

For some reason, there doesn't seem to be an actual sequence listener, but you can sort of reconstruct the sequence like this:

    SpotlightView slideOne = new SpotlightView.Builder(activity)
            .target(firstView)
            .setConfiguration(mConfig)
            .headingTvText("Example")
            .subHeadingTvText("Example")
            .usageId(ID_STRING_1)
            .show();

    final SpotlightView.Builder menu = new SpotlightView.Builder(activity)
            .target(secondView)
            .setConfiguration(mConfig)
            .headingTvText("Example")
            .subHeadingTvText("Example")
            .usageId(ID_STRING_2);

    SpotlightListener listener = new SpotlightListener()
    {
        @Override
        public void onUserClicked(String s)
        {
            switch (s) {
                case ID_STRING_1:
                    menu.show();
                    break;
                case ID_STRING_2:
                    break;
            }
        }
    };

    drawer.setListener(listener);
    menu.setListener(listener);

The onUserClicked() function will execute whe the slide is disappearing. To set an action for the end of the tutorial, just add a case in the switch for the ID of your last slide.

@Ankur008
Copy link
Author

In my case, I am showing multiple screen using the SpotlightSequence,

SpotlightSequence.getInstance(MainActivity.this, null)
.addSpotlight(profile_pic, "Edit Profile", "Change your profile pic & Edit profile info", INTRO_PROFILE + randomChar)
.addSpotlight(bpBlock.leftImage, "Add BP reading ", "You can add BP readings here", INTRO_ADDBP + randomChar)
.startSequence();

here how can I add the listener in the sequence?

@dhavalwooplr
Copy link
Contributor

@Ankur008 , @zacharee , Added a listener for that. Please check the fix here #71 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants