Closed BeksOmega closed 4 years ago
Here is a picture documenting how I set up the estimateShortestRoute tests:
The tests set up the views in the given configurations, and then they attempt to scroll to the underlined index. After scrolling the view associated with the index should be visible on the side where it is underlined. For example, in the top diagram, after scrolling, the "0" view should be aligned with the left edge of the recycler/screen.
:clap: Resolves
Closes #5
:star2: Description
Adds support for the scrollToPosition function.
This mostly follows the original proposal in the issue. There are only two main differences:
The default direction-determining strategy estimates which direction would be shortest. This assumes that all of the views in the recycler are the same size. If they are not the same size this function could be incorrect.
With a function-based system, if a developer has views with varying sizes, they can pass their own function that takes these differences into account.
By default I decided to provide three DirectionDecider functions:
New views will be added at the anchor edge until the target view is visible.
New views will be added at the edge opposite teh anchor edge until the target view is visible.
As described above, this attempts to minimize the amount of scrolling.
:bug: Testing
Lots of tests! 84 in total.
:thought_balloon: Other info
N/A