Fix layout state setup for predictive layouts

When setting up layout state for scrap list (predictive layout pass),
we would not set currentPosition properly since the next view
was already defined by distance.
This was creating an issue in GridLayoutManager because it uses
this position to call SpanSizeLookup before accessing the View.
GridLayoutManager should work that way because it should avoid
getting a View from next row / column (in the case when next View
does not fit current row).

LayoutState could also return null View even if hasMore() returns
true which was part of the reason for this bug.

This CL fixes that issue and also adds logic to calculate
LayoutState#currentPosition from scrap list. It is a bit slower
because I wanted to keep this CL minimal. Can be optimized but
it is not event a hot code path so not very important anyways.

Also added a test for the crash and more assertions to guarantee
currentPosition and hasMore methods.

Bug: 20158083
Change-Id: Iefd4775161485185fc6255a20cddc3bddfd04134
4 files changed