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

Fragment transition when restoring from saved state #88

Closed
liquidninja24 opened this issue Sep 14, 2017 · 11 comments
Closed

Fragment transition when restoring from saved state #88

liquidninja24 opened this issue Sep 14, 2017 · 11 comments

Comments

@liquidninja24
Copy link

liquidninja24 commented Sep 14, 2017

Hey Nick,

When restoring from saved instance state the default transition animations are being applied to the current fragment: https://github.com/ncapdevi/FragNav/blob/master/frag-nav/src/main/java/com/ncapdevi/fragnav/FragNavController.java#L901

I believe the call to switchTab should be invoked with an empty set of FragNavTransactionOptions so that the default options are overwritten, and the current tab / fragment is immediately shown.

@ncapdevi
Copy link
Owner

@liquidninja24 makes sense to me. I'll go ahead and add that.

@liquidninja24
Copy link
Author

@ncapdevi Thanks! Any idea when that change would get committed and tagged?

@ncapdevi
Copy link
Owner

Everything is seemingly stable so I can push an update (2.2.2) this evening.

@liquidninja24
Copy link
Author

Sweet, thanks man!

@liquidninja24
Copy link
Author

Had a look at the code. I think you need to pass an empty FragNavTransactionsOptions object here:

a478a4e#diff-d9ef9db018ea0b9cdc4dce6b5cbfa071L901

otherwise it'll use the default transaction options as defined here:

@ncapdevi
Copy link
Owner

Ah, you appear to be correct, good catch. Apologies for that.

@liquidninja24
Copy link
Author

Also, It may be better / helpful to create a static constant to signify no transaction options that can reused, rather than creating a new object every time. In FragNavTransactionOptions:

public static final FragNavTransactionOptions NO_OPTIONS = new FragNavTransactionOptions(new Builder());

@liquidninja24
Copy link
Author

I'm sorry to keep bugging you about this, but I'm trying to add a feature to my app and this is an annoying bug. I know you're busy, but I would really appreciate it if you could push out a tag in the next day or two.

@ncapdevi
Copy link
Owner

ncapdevi commented Sep 20, 2017

Ah, should be out now in compile 'com.ncapdevi:frag-nav:2.2.2' Apologies, pushed it the other night, but should've given you a heads up.
Also, I thought about a static variable for it, but it's only happening on restoreState, which in the vast majority of sessions never happens, so it's totally find to lazily create it when it's needed. Plus would never happen in a loop. If we end up needing a NO_OPTIONS anywhere else in the code, then I'll make it a constant, but for the time being, this is technically more efficient.

@liquidninja24
Copy link
Author

Thanks a lot man!

@ncapdevi
Copy link
Owner

👍 Cheers. Thanks, as usual, for your insight and help.

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

2 participants