d586ba8825b418d9589436725bfdead30f0dc075 |
|
28-Jan-2015 |
Dake Gu <dake@google.com> |
Reduce memory consumption of DPAD scroll multiple column grid Created a special SmoothScroller to handle onFocusSearchFailed for multiple column cases. It remembers the pending movements caused in onFocusSearchFailed and consume the pending DPAD movements when a view is laid out in the direction. The change avoids appending or prepending excessive views on the scroll direction which is not within screen bounds. Add a onLaidOut() listener for VerticalGridFragment to check if we hit the first row. If the grid is three columns. Previously (before introducing the special SmoothScroller) we always prepend one row of items before fire onSelected event, so when we fire onSelected(1), item0 is already in the tree and havePreviousViewInSameRow() returns false. Using the special SmoothScroller, onSelected is fired at the time a view is created. Checking hasPreviousViewInSameRow() at the time item1 is selected will return true because item0 has not been created yet. So VerticalGridFragment should also listen to when item0 is added to hierarchy. Applied a MAX_PENDING_MOVES to avoid overscroll too much. Issue: 19150678 Change-Id: I7cf0093a4bee652f60c5f2004b799ee7c3f87fc8
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/OnChildLaidOutListener.java
|