jack-bradshaw/SlidingIntroScreen

generateFinalButton transition

neutt22 opened this issue · 7 comments

I'm having an issue where the overridePendingTransition doesn't work. Here's my current work:

@Override
public IntroButton.Behaviour generateFinalButtonBehaviour() {
    final Intent mainActivity = new Intent(this, MainActivity.class);

     IntroButton.Behaviour behaviour = new IntroButton.ProgressToNextActivity(mainActivity, null);
     overridePendingTransition(R.anim.slide_from_bottom, R.anim.slide_from_bottom);

    return behaviour;
}

Thanks!

I think you're using overridePendingTransition() incorrectly. Call it in onCreate of MainActivity.java.

Let me give it a try in couple hours.

EDIT:
Nope, no animation on onCreate

Going to the IntroActivity has no problem because I start the activity from MainActivity.
The problem is going back to MainActivity from IntroActivity using the generateFinalButtonBehaviour
Hope that made it clear for you. Thanks!

So let me see if I've got this right. You launch MainActivity first, then you launch IntroActivity, then when the intro is done you go back to the MainActivity?

I think perhaps instead of using the ProgressToNextActivity behaviour, implement the interface and create a new behaviour which calls finish() in the IntroActivity. That way you can end the IntroActivity, and I assume that's where you should call overridePendingTransition().

Not really too sure about this TBH, but I don't think it's an issue with the library because currently all the next activity behaviour does is call startActivity(Intent) when the button is clicked.

You got it right, I launch MainActivity first, then it launches IntroActivity, when Finish button is clicked, it goes back to MainActivity.

I guess implementing a new ProgressToNextActivity might be a good idea. I'll let you know on this thread. Thanks!

Issue solved by subclassing ProgressToNextActivity and overriding run method. Thanks!

Great, glad it worked!