-
Notifications
You must be signed in to change notification settings - Fork 1
Apply setMaxLifecycle during fragment transaction & update dependencies #2
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
Apply setMaxLifecycle during fragment transaction & update dependencies #2
Conversation
@@ -275,6 +278,13 @@ class FragNavController constructor(private val fragmentManger: FragmentManager, | |||
} else { | |||
//Attempt to reattach previous fragment | |||
fragment = addPreviousFragment(ft, shouldDetachAttachOnSwitch() || shouldRemoveAttachOnSwitch()) | |||
|
|||
fragmentCache.values.forEach { ref -> |
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.
Should it be an option to set max lifecycle? Without this it will change behaviour of existing apps
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.
Right, good catch 👍 Will deal with it
frag-nav/src/test/java/com/ncapdevi/fragnav/tabhistory/UnlimitedTabHistoryControllerTest.kt
Outdated
Show resolved
Hide resolved
frag-nav/src/test/java/com/ncapdevi/fragnav/tabhistory/UniqueTabHistoryControllerTest.kt
Outdated
Show resolved
Hide resolved
frag-nav/src/main/java/com/ncapdevi/fragnav/FragNavController.kt
Outdated
Show resolved
Hide resolved
e245b01
to
ec9ec14
Compare
|
||
# https://github.com/kt3k/coveralls-gradle-plugin/issues/85 | ||
systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2" |
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.
Ehh, it's not very nice, it makes connection less secure, but I think we have no way to fix it without changing code coverage service
…es (#2) * Apply setMaxLifecycle during fragment transaction & update dependencies * Updated travis config * Deprecated few properties + adjust publishing config * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Add an option to set max lifecycle * Fix some lint warning * Fix missing dependency in test * Address review comments * Update jacoco report path * Workaround for coveralls SSLException Co-authored-by: Andrey Mischenko <gildor@users.noreply.github.com>
…es (#2) * Apply setMaxLifecycle during fragment transaction & update dependencies * Updated travis config * Deprecated few properties + adjust publishing config * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Update .travis.yml * Add an option to set max lifecycle * Fix some lint warning * Fix missing dependency in test * Address review comments * Update jacoco report path * Workaround for coveralls SSLException Co-authored-by: Andrey Mischenko <gildor@users.noreply.github.com>
Story
There's a known issue that if you use the hiding strategy on the fragment switch, the fragment's lifecycle won't be changed.
However, there's a new setMaxLifecycle function been added in the
FragmentTransaction
which can set the maximum lifecycle state during the transaction, andViewPager2.FragmentStateAdapter
actually has such implementation.Bringing this function call to the library for the hiding strategy, so the fragment lifecycle will be triggered properly during switching.
What have been changed in this PR: