Skip to content

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

Merged

Conversation

kevinguitar
Copy link

@kevinguitar kevinguitar commented Apr 1, 2022

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, and ViewPager2.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:

  • Set max lifecycle to "Started" for those fragments that are going to be hidden in the transaction.
  • Updated quite a lot of dependencies
  • Adjusted the gradle settings for internal publishing

@@ -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 ->
Copy link
Member

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

Copy link
Author

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

@kevinguitar kevinguitar force-pushed the apply-max-lifecycle branch from e245b01 to ec9ec14 Compare April 5, 2022 01:45

# https://github.com/kt3k/coveralls-gradle-plugin/issues/85
systemProp.jdk.tls.client.protocols="TLSv1,TLSv1.1,TLSv1.2"
Copy link
Member

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

@kevinguitar kevinguitar merged commit bcf7de4 into bandlab:apply-max-lifecycle Apr 5, 2022
kevinguitar added a commit that referenced this pull request Apr 5, 2022
…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>
kevinguitar added a commit that referenced this pull request Apr 5, 2022
…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>
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

Successfully merging this pull request may close these issues.

3 participants