Finding a replacement for FragmentStatePagerAdapte

2020-04-19 08:09发布

问题:

I want to find a replacement to the FragmentStatePagerAdapter + PagerFragment as we all know the FragmentStatePagerAdapter is still broken up to this day. There have been a bunch of attempts on github and by myself to make something that mimics the functionality of the FragmentStatePagerAdapter, except all of them seem to have extremely complicated logic with bugs that seem impossible to debug, e.g. https://gist.github.com/ypresto/8c13cb88a0973d071a64.

The core functionality of my application needs to be able to display fragments/views dynamically, e.g. a photo carousel with interleaving ads as the user swipes from left to right and vice versa. And we can dynamically remove or add or manage stuff from/to the adapter.

I've been thinking of potentially making a horizontal recycler view with the view taking up the full screen, and having a bunch of listeners that make the view "center" as the user swipes so that it has a view pager feel to it. But I'm not 100% convinced that this is the best solution to solving this issue. I was wondering if anyone has ever come across issues with FragmentStatePagerAdapter, and has found a good solution to workaround.

Thanks for the help!