Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Swipe Back/Prev is very sensitive #34

Closed
JeffInMadison opened this issue Jan 8, 2014 · 3 comments
Closed

Swipe Back/Prev is very sensitive #34

JeffInMadison opened this issue Jan 8, 2014 · 3 comments
Labels

Comments

@JeffInMadison
Copy link

I have an EditText on one of my WizardStep pages and when I go to select it to enter text 8 times out of ten it will go to the next/previous wizard step because if the touch moves at all it's interpreted as a swipe.

I've also noticed that I can put my finger on the right most side of my screen and if I swipe left I can go multiple pages in one long swipe left.

I tracked it down to the setOnPageChangeListener in Wizard.java. I cloned the repo and commented out that listener out of curiosity and everything still seems to work.

Did you override the built in ViewPager funtionality for a reason I am not seeing?

@Nimrodda
Copy link
Owner

Yes, I had to override the built-in ViewPager functionality to capture when the user slides to the next step/previous step and call goNext() or goBack() accordingly. If you comment out this part, it means that no events will be triggered (when the step is exiting, the wizard is finished, etc) and most importantly, the step context won't be persisted so you won't be able to use the data from that step in other steps. Basically, you just disabled all the logic :) check out the code:

 public void goNext() {
         if (canGoNext()) {
             wizardFlow.setStepCompleted(getCurrentStepPosition(), true);
             getCurrentStep().onExit(WizardStep.EXIT_NEXT);
             contextManager.persistStepContext(getCurrentStep());
             //Tell the ViewPager to re-create the fragments, causing it to bind step context
             mPager.getAdapter().notifyDataSetChanged();

        if (isLastStep()) {
            callbacks.onWizardComplete();
        }
        else {
            //Check if the user dragged the page or pressed a button.
            //If the page was dragged then the ViewPager will handle the current step.
            //Otherwise, set the current step programmatically.
            if (!fingerSlide) {
                setCurrentStep(mPager.getCurrentItem() + 1);
            }
            //Notify the hosting Fragment/Activity that the step has changed so it might want to update the controls accordingly
            callbacks.onStepChanged();
        }
        }
}

@virtualvoid
Copy link
Contributor

I have this issue too, I think this should be configurable. For example :

wizard.setSwipeable(boolean).

@Nimrodda
Copy link
Owner

@virtualvoid you should get the latest version. The issue is fixed.

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

No branches or pull requests

3 participants