Allows for efficient display Fragments
in a ViewPager2
by using DiffUtil
to diff changes in
the adapter. Extensions are available for both Fragment
and FragmentActivity
types.
There are 1 main building blocks:
FragmentTab
a type that represents aFragment
in theViewPager2
, it's purpose is to map to aFragment
and uniquely identify a it by it's contents, you want to use adata
class to implement this, or at the very least a class with stableequals
andhashcode
implementations.
With that, updating the ViewPager2
is as simple as FragmentListAdapter.submitList(newTabs)
.