Improve scrolling, handle onNestedPreFling
This contains three main changes.
1 Carry momentum from flings in the header into the ListView.
2 The header now snaps into a semi collapsed state more often
then it used to
3 The current scrolling direction is now a larger factor in deciding
where the header position will snap to upon finishing a scroll
I coupled ViewDragHelper a bit closer to OverlappingPaneLayout. At first
I tried to avoid this. But I think this was a wasted effort. ViewDragHelper
is specifically forked for OverlappingPaneLayout.
Some behaviors I made sure to test manually:
1 When expanding/collapsing the header the direction of motion should
determine where the header snaps to upon release.
2 Collapsing from fully open to intermediate (not previously possible)
3 Drag tabs up/down regardless of whether at top of ListView or not (unchanged)
4 Dragging and releasing the tabs should cause the same sort of snapping behavior as
scrolling and releasing the nested ListView (this still isn't exactly the same.
I don't think this is important enough to dig into more)
5 After fully expanding the header by grabbing on the tabs, you can collapse
the header normally via nested scrolling.
6 Scroll down the ListView. Then expand the header by dragging the tabs.
Now scroll up and down in the ListView a bit.
7 Quickly fling up, down, up, down, up, down, up, down, up, down. Should
feel the same as scrolling a regular ListView.
8 Fling upwards, stop the fling prematurly then release. The header shouldn't
do anything (fixing this was a matter of adding a scroll slop).
Bug: 16462679
Change-Id: I272a838885ce9045d41aaef1168b0ee0a32ee31d
4 files changed