-
Notifications
You must be signed in to change notification settings - Fork 555
feat: retain fragments while switching #617
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
Conversation
|
Also tried using reflections here are the details : Error log |
| } | ||
|
|
||
| private fun checkAndLoadFragment(fragment: Fragment) { | ||
| val frag = supportFragmentManager.findFragmentByTag(fragment::class.java.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to savedFragment
| if (frag != null) { | ||
| loadFragment(frag) | ||
| Timber.d("Loading fragment from stack...") | ||
| } else loadFragment(fragment) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wrap in curly braces
| val frag = supportFragmentManager.findFragmentByTag(fragment::class.java.name) | ||
| if (frag != null) { | ||
| loadFragment(frag) | ||
| Timber.d("Loading fragment from stack...") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add class name in log to show which fragment is being loaded
| import retrofit2.http.GET | ||
| import retrofit2.http.POST | ||
| import retrofit2.http.Path | ||
| import retrofit2.http.* |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Irrelevant change
| val savedFragment = supportFragmentManager.findFragmentByTag(fragment::class.java.name) | ||
| if (savedFragment != null) { | ||
| loadFragment(savedFragment) | ||
| Timber.d("""Loading fragment from stack ${fragment::class.java}""") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
even a single " would work
|
@nikit19 @iamareebjamal please review and merge |
fixes #616