FragNav icon indicating copy to clipboard operation
FragNav copied to clipboard

Be able to setMaxLifecycle during the fragment transaction

Open kevinguitar opened this issue 2 years ago • 0 comments

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:

  • Offered a setMaxLifecycleOnSwitch flag in FragNavController, and set max lifecycle to "Started" for those fragments that are going to be hidden in the transaction.
  • Updated quite a lot of dependencies and gradle plugins
  • Adjusted the gradle settings for publishing

Related issue: https://github.com/ncapdevi/FragNav/issues/244

Original pull request: https://github.com/bandlab/FragNav/pull/2 coauthored by @gildor

kevinguitar avatar Apr 05 '22 02:04 kevinguitar