1

I'm trying to do a sort of infinite scroll. Each Fragment contains a scrolling WebView (or ScrollView), and when the user hits the bottom, I'd like to test for continued swiping to reveal the next Fragment below.

The user should not be able to go back, and I'm not interested in caching, so that rules out RecyclerView or ViewPager (modified to scroll vertically). I'm only concerned about managing the current Fragment, loading the next, and removing the last one once it's offscreen.

I want the next Fragment to follow the users touch, and I want the transition to abort if the user lets go below a certain threshold.

FragmentManager allows custom animations but they are non-interactive. I could perhaps write my own ViewGroup where I can manually animate a Fragment into position, and remove the previous Fragment manually, but I'm not sure if this is the best path forward.

Anyone have thoughts/tips on a good approach here?

ray
  • 1,966
  • 4
  • 24
  • 39
  • If I were you I would not rule out using a modified `ViewPager` or `RecyclerView`. I would drop the fragment though, if it only encapsulates a `WebView`. You can probably just go along with a `RecyclerView` and block the scrolling back, by means of removing the child that is no longer shown to the user and adding the next one – Alex.F Oct 22 '18 at 12:26
  • "Cake" browser does something like this in a horizontal motion. Though they do have a back motion. – Alex.F Oct 22 '18 at 12:32

0 Answers0