History log of /frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
a5bdf8e4c360022cd211b2cb9f3807b7cf7b50a2 30-Jun-2017 Keyvan Amiri <keyvana@google.com> Fixed NPE in onAddFocusables

If the currently focused child is invalidated, findViewByPosition could
return null for valid focused child index. This caused onAddFocusables
crash when adding focusable views for the currently focused child.

Bug: 36738635
Test: Not reproduciable for now
Change-Id: I6c455f5b25fc8ce3cdd476fa5c6f19c76a302100
(cherry picked from commit d1c84431459c8f6196777617d8d32e3206b58412)
Merged-In: I6c455f5b25fc8ce3cdd476fa5c6f19c76a302100
(cherry picked from commit 1d3842a69a4a1ff5d3fc9e0f46b291e2ac5728ac)
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5723e456309c09c31054d29187fd26b6e2b760ef 17-Jun-2017 Dake Gu <dake@google.com> DO NOT MERGE leanback: fix fastRelayout for extra views added in preLayout

Then in post layout pass, fastRelayout() should invalidate after
the item that position is inconsistent with Grid position.
Previously this was relying on didStructureChange(), it is now
no longer safe to do so when prelayout may add items before first
child.

Bug: 62727612
also no longer reproduce Bug 36738635 after this change
Test: testMoveIntoPrelayoutItems

Change-Id: If67f6697b21c132ed5934bdc0fc2790ac4aae32c
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
2d973a4fe4a42e14aed6278b14998964dd18f3c0 16-Jun-2017 Dake Gu <dake@google.com> DO NOT MERGE leanback: fix wrong insert view index in fastRelayout

Bug: 62451353
Test: testWrongInsertViewIndexInFastRelayout
Change-Id: I2e127650d9374a2f061aa18790ec366448d0a886
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
92fd72dacfea51814e05f24a092aaa2ae12c8449 15-Jun-2017 Dake Gu <dake@google.com> DO NOT MERGE leanback: clarify comments

And modify the test to be what exactly happened
in the original bug.

Bug: 62448243
Test: testLayoutWhenAViewIsInvalidated
Change-Id: Id4cfa3e97ad179474c172d6cfc45149b759097ae
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5db6d414ed0329b4f5464a92d1a7f8e6d8bb1678 09-Jun-2017 Keyvan Amiri <keyvana@google.com> DO NOT MERGE Fixed fastRelayout when a view is invalidated

The views that are off the screen are cached and invalidated after a
layout. getAdapterPositionByView returns NO_POSITION for such views that
was causing crash in fastRelayout when getViewForPosition was called.
Now will skip laying out children when such a view is encountered.

Bug: 62448243
Test: testLayoutWhenAViewIsInvalidated
Change-Id: I5bb86682dba0bff6a4a5e77438b4735a2a720345
(cherry picked from commit e79b22a10835076150c04e96c52d8342b3af8409)
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
bb1f461f210836de67bc68980409c5112889299a 27-May-2017 Dake Gu <dake@google.com> leanback: better cordinate scroll and itemanimator

Instead of scroll jump for child size change, onLayoutChildren() will
start a new scroll animation if previous scroll animation
was going to stop at unaligned position due to child size / position
changes.

Bug: 38339297
Test: testSwapAfterScroll

Change-Id: I3a5174f3a76c7269bfa5a5f6f28b1ba3875433db
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
c50aca4940c8ae508393278aa7a9c77a3f93f87d 26-May-2017 Dake Gu <dake@google.com> leanback: fix predictive animation move

1. When move items out, we need use addDisappearingView to
tell recyclerview to slide them out and those views will
not be pruned by scroll pass. This is done by adding
scrapList views in post layout fillDisappearingItems()

2. When move items out, we need check if item is moving
out side old adapter's range, prelayout needs layout extra
space for these cases.

Bug: 38339297
Test: testDontPruneMovingItem testMoveItemToTheRight
testMoveItemToTheLeft

Change-Id: I6e2c4ffeb8befb62f060247bb6c5345dc8f6bab7
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
134b0891c25facf14c53ef939846010284025ca9 20-May-2017 Dake Gu <dake@google.com> leanback: support predictive animation

1. supports predictive animation
2. no longer abort scrolling upon state.didStructureChange() is true.
So scroll animation will continue while item animation is running.

Bug: 38339297
Test: GridWidgetTest

Change-Id: If5b4a05e3dca9946395dd19204c2fcd59fa7a824
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
b6dde2cfe2fbe3151c52d92e3754288aab11a3b1 05-May-2017 Dake Gu <dake@google.com> leanback: support preferring key line over edge

We have a requirement that for WINDOW_ALIGN_HIG_EDGE, when there are
limited items, we prefer the first item aligned to keyline instead
of last item aligned to bottom padding. Introduced two APIs:
setPreferKeyLineOverLowEdge and setPreferKeyLineOverHighEdge.
"prefer keyline over low" is by default false.
"prefer keyline over high" is by default true since keyline is
before high edge and user usually prefer align to lower side.

In current implementation, the scroll_max is always decided by the
last item align to edge of bottom padding.

When we prefer keyline over high edge, scroll max is no longer only
decided by last item, it will be decided by both the last item and
first item. So we will need updateScrollMin/Max altogether.

The CL also clean up GridLayoutManager code, no longer need concept
of mScrollOffsetPrimary.

Bug: 38036352
Test: testPreferKeyLine1 testPreferKeyLine2 testPreferKeyLine10000
testScrollSecondaryCannotScroll testScrollSecondaryNeedScroll

Change-Id: Ia1e03b3eb8f5d78255090380684e35e5434172bc
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e36e2ce16cbd6144ccd49e0b90ae4c587a08c8f3 10-Apr-2017 Dake Gu <dake@google.com> leanback: switch to use getAdapterPosition() for accessbility node

Disappearing ITEMs that were pushed out of the RV due to inserting
other items will crash when onLeftHiddenState changes
importantForAccessibility to yes. The item's viewLayoutPosition is
invalid, so we should use AapterPosition which will return -1 and
onInitializeAccessibilityNodeInfoForItem will bail out.

This bug will happen on any LM which does not support preLayout uses
viewLayoutPosition in onInitializeAccessibilityInfo.

Bug: 37096264
Test: testAccessibilityNodeInfoOnRemovedLastItem
testAccessibilityNodeInfoOnRemovedFirstItem
simulatesAccessibilityOfItemsBeingPushedOut
testAccessibilityOfItemsBeingPushedOut

Change-Id: I2804b5b55f2cbc917155cf8b902b9487f65b8e28
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
89097f67f988ebba714a95e10369665280db0c27 25-Mar-2017 Dake Gu <dake@google.com> DetailsFragment: support switchToVideo in onCreate

Allows DetailsFragment to be put in intial video mode
and skip entrance transition and enter transition.

The DetailsFragment's state model is fairly complicated
including entrance transition, enter transition and
switchToVideo call. So reworked StateMachine and based
DetailsFragment on StateMachine, remove the PF_ flags used
before.

When switchToVideo is called in DetailsFragment.onCreate,
there is no video fragment yet, but we still fade out
cover drawable and create a pending flag once the video
fragment view is created will focus on to it.

Added support in GridLayoutManager to allow slideOut() when
there is no child, and layout the first pass out of
window.

switchToVideo is not allowed with entrance transition.
once prepareEntranceTransition is called, switchToVideo will
be ignored until entrance transition is finished. On the other
hand, calling prepareEntranceTransition after switchToVideo
will be ignored.

switchToVideo will clear activity enter transitions. Once
it is called in onCreate, we do not want the activity enter
transition to run.

Test: bunch of new tests in DetailsFragmentTest for all kinds
of scenarios
Bug: 36126851

Change-Id: Ic0279331b12b1e285507dffda3ad351245c01a1b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
af3606dbd00dd77a2b0d0950edf203247509ad4c 28-Mar-2017 Dake Gu <dake@google.com> leanback: fix alignment when appending to last item.

When append new item, it falls into fastRelayout() path
where LM didn't updateScrollMin/Max for the new item.

Bug: 32488200
Test: testAddLastItemHorizontal testAddMultipleLastItemsHorizontal
Change-Id: I660207a1fa48ff899e487b4ee457b57067ab4725
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
6525e063fbbd691a8553f4fc77f3960f93bea34d 22-Mar-2017 Dake Gu <dake@google.com> Fix multiple bugs related with DetailsFragment:

1. If onStart reinitialize the adapter, it may causes
BaseGridView.animateOut() being called when there is
no child which causes NPE in GridLayoutManager.slideOut()
2. In DetailsFragment.onStart() we should not requestFocus()
on vertical grid view if DetailsFragment already gains focus,
otherwise it will move focus out of embedded video playing.
3. remove support of DPAD_DOWN from playback to details ui.
The returning is done through BACK.
4. Fix the flaky DetailsFragment navigation tests.
5. Make PlaybackFragment internal variable package private
to remove potential generated stub method and easy to test.
6. Change DetailsFragmentTest to be "LargeTest" to skip
the TreeHug integration.

Bug: 36492114
Test: DetailsFragmentTest DetailsSupportFragmentTest

Change-Id: Ia437611c234565aa6a85709c897cdd436ff21cf9
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
694edde99dc3782374977dab6d9aa34a16c13337 15-Mar-2017 Dake Gu <dake@google.com> leanback: fix errorprone warnings

Bug: 36252690
Test: N/A
Change-Id: I60a692554882a17d63789a689b4d4c3c37a00aed
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5c4d5ee6697503c9c170fe240b0fe97792d83904 14-Mar-2017 Dake Gu <dake@google.com> leanback: fix crash caused by wrong position

When notifyDataSetChange() is called on Adapter that clears
its data and has stable ids, it will trigger a requestChildFocus()
in creating DISAPPEARING animation. At that time we should
use adapter position instead of view position. The adapter
position would be -1, so requestChildFocus() should do nothing.

Bug: 36139432
Test: GridWidgetTest.testRemoveLastItemWithStableId

Change-Id: Ief37156d58c2596c28002143cd14395ade24c6a5
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
b484ccb63d546196c4b39f9a86a9c714006cfdc3 04-Mar-2017 Dake Gu <dake@google.com> leanback: fix bad state of mFocusPosition

When smoothScroller starts, the target position is cropped by adapter
size, leanback doesn't adjust its internal mFocusPosition, which
causes unable to focus to a child in onRequestFocusInDescendants().

The launcher could fix this by double check the position before pass
to setSelectionSmooth().

Bug: 32118060
Test: testSmoothScrollerOutRange
Change-Id: I5c4ea3b3b4776971f511b0d689e4f9c66bb5ae47
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
d6696c2abea2771acd000c2269cf9113acc6c0a9 02-Mar-2017 Chris Craik <ccraik@google.com> Fix prefetch item count naming

Fixes: 35855437
Test: adb shell am instrument -w -r -e debug false -e size small android.support.v17.leanback.test/android.support.test.runner.AndroidJUnitRunner
Test: adb shell am instrument -w -r -e debug false -e size small android.support.v7.recyclerview.test/android.support.test.runner.AndroidJUnitRunner

Change-Id: Ifa5afd2260b4705aa9f7b8771cc35b4cb3fc2363
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5c05fc026b77c6387917560f8dbbbd4bff13bbf9 23-Feb-2017 Dake Gu <dake@google.com> Suppress layout handling during animateOut()

When playing video, data change of rows will automatically
pulls row in. This CL suppresses layout when animateOut()
until a specific animateIn() is called.

Bug: 35399351
Test: testAnimateOutBlockLayout testAnimateOutBlockSmoothScroll
testAnimateOutBlockScrollTo
Change-Id: Ie91137687e96f0d48a674c410041b9412c8945d6
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
dfd191344d980025695f3c3e96f7097f33c19a29 17-Feb-2017 Chris Craik <ccraik@google.com> Merge "Support nested prefetch in leanbacklib's gridviews" into nyc-support-25.2-dev
dac5dcf32af1e67c9ee09991b600bbb55976a653 17-Feb-2017 Chris Craik <ccraik@google.com> Support nested prefetch in leanbacklib's gridviews

Fixes: 32981813
Bug: 35443218
Test: GridWidgetPrefetchTest passes

Includes minor workaround for attached, non-drawing RecyclerViews

Change-Id: Icf34bf8db941b4d03d23230d19676da03d5e990e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
8e06d698aa47dfdea344d2529f2879489eb4610f 16-Feb-2017 Dake Gu <dake@google.com> leanback: Fix BaseGridView.animateIn()

We dont need animateIn() since layout manager will slide in
items when user refocus or scroll to the item.
What is nicer is that the refocus logic already handles the
half way slide back. It is wrong that animateIn() slides a
fixed distance.

Also added support for animateOut for HorizontalGridView.

Add missing implementation of smoothScrollToPosition()

Bug: 35399351
Test: testAnimateOutResetByScrollTo testAnimateOutResetByFocusChange
testHorizontalAnimateOutResetByScrollTo testHorizontalAnimateOutRtl

Change-Id: Ia24c10ecf812cc1609acfa529b226ad87bf8da3a
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9c0ad7d5adfbe51d85adcbc056b6183095d8aaed 29-Nov-2016 Keyvan Amiri <keyvana@google.com> Made unfocusable views in RecyclerView visible when using key navigation

This CL handles the new scrolling strategy for unfocusble views in 2
major scenarios:
1. When using DPAD navigation, the unfocusable views that went
out-of-bounds never became visible again. This was because RV relied on
requestChildFocus callback from framework, which wasn't triggered for
unfocusable items.
2. if the scrolling distance between two consecutive focusable items
was greater than a third of a page, the scrolling got stuck.
This change increases this distance to at least one full page.

All LayoutManagers' onFocusSearchFailed are reimplemented to handle the new
logic.

Fixes: 33117253
Test: ./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.LinearLayoutManagerTest
./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.GridLayoutManagerTest
./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.StaggeredGridLayoutManagerTest
./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.ViewBoundsCheckTest

Change-Id: I0c4dd4ab3ee51ff99f30e1a4de11bda6920dab43
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
b0818cc234e9df4312732f95fd6849922bfa0fa1 30-Jan-2017 Keyvan Amiri <keyvana@google.com> Fixed focus transfer for GridLayoutManager and Leanback picker widgets

GridLayoutManager continued focus search even if the parent blocked the
focus delivery to its children. Also, Picker widget did not have the
right focus logic for the containing view and its child text views in
activated/deactivated modes. This CL fixed these 2 issues.

Bug: 34814581
Test: ./gradlew support-leanback-v17:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v17.leanback.widget.DatePickerTest
./gradlew support-leanback-v17:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v17.leanback.app.wizard.GuidedDatePickerTest

Change-Id: I90d4b9f870ae3f16c4591fd0b1e085a568ca4c7d
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
613079c6ece985c910852456fbff5dc9532df646 08-Feb-2017 Aurimas Liutikas <aurimas@google.com> Revert "Made unfocusable views in RecyclerView visible when using key navigation"

ag/1865310 caused tests to start flaking.

This reverts commit 530bca4dc2f96336c1169d993384b7884238d71e.

Bug: 33117253
Change-Id: I0b7522f1abc6d9574e98bc6062a407d3418c37d0
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
530bca4dc2f96336c1169d993384b7884238d71e 29-Nov-2016 Keyvan Amiri <keyvana@google.com> Made unfocusable views in RecyclerView visible when using key navigation

This CL handles the new scrolling strategy for unfocusble views in 2
major scenarios:
1. When using DPAD navigation, the unfocusable views that went
out-of-bounds never became visible again. This was because RV relied on
requestChildFocus callback from framework, which wasn't triggered for
unfocusable items.
2. if the scrolling distance between two consecutive focusable items
was greater than a third of a page, the scrolling got stuck.
This change increases this distance to at least one full page.

All LayoutManagers' onFocusSearchFailed are reimplemented to handle the new
logic.

Fixes: 33117253
Test: ./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.LinearLayoutManagerTest
./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.GridLayoutManagerTest
./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.StaggeredGridLayoutManagerTest
./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.ViewBoundsCheckTest

Change-Id: I1d1fb0fa5e3d274840a1907e604749c6a1dbd447
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
cf2ed161d09de8af108dfa9775b2d4449d46306a 25-Jan-2017 Chris Craik <ccraik@google.com> Initial prefetch support for leanback's GridLayoutManager

Bug: 32981813
Test: new tests passing

Prefetch 1 row/column, without nested support yet.

Change-Id: I7bd467e5176791d68002c98d663ee637b5e0d3d9
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
6f5495baf9acf7b275839e4a1eea091781fd112b 14-Oct-2016 Susnata Basak <susnata@google.com> Merge "Adding video player to DetailsFragment."
4702556bfd15c9819a7b2af759aee0f719cd631f 11-Oct-2016 susnata <susnata@google.com> Adding video player to DetailsFragment.

Added VideoFragment for rendering videos to DetailsFragment.
Video playback will be configured by DetailsFragmentVideoHelper.
Parallax functionality will continue to be configured by
DetailsBackgroundParallaxHelper. ParallaxManager will be shared
between the helpers for running animations based on the position
of DetailsOverview view.

Updated LeanbackSupportDemo(NewDetailsFragment) sample code to
use the video player.

Test: None
Change-Id: Iaeee2caf3b7f3567e4a53ad76574db9adaa32ba0
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
21ac4a7e2cc753b4e4eeaa7edb9696add157ebf8 08-Oct-2016 Dake Gu <dake@google.com> Fix some flaky test

Use onLayoutCompleted() callback to wait layout.

Bug: 31771962
Test: GridWidgetTest

Change-Id: I30b72ed046bf2b7d24db7c6cd920e6b5825d5593
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
02bc902b96bc014f9242205f195cf62e1482e84f 06-Oct-2016 TreeHugger Robot <treehugger-gerrit@google.com> Merge "leanback: switch to use standard TraceCompat"
bbc48593794ced540ed3d5fd798251be06876642 04-Oct-2016 Dake Gu <dake@google.com> leanback: switch to use standard TraceCompat

Remove the class introduced before TraceCompat

Test: unit tests
Bug: None

Change-Id: Ie411092fc6e2b053472399bc320ee1fbf1969718
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
03eae4e82fccd027e003a8d1544d3e9023404b14 03-Oct-2016 Dake Gu <dake@google.com> leanback: dont clearFocus in layoutInit

clearFocus() triggers unecessary focus search.

Test: added two test cases and run against all widget test
Bug: none
Change-Id: I78bad294d70b79d9d28c7d9015db8dca11081dfb
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3103f63e99d47573823957f7aa34308555873221 20-Sep-2016 Aurimas Liutikas <aurimas@google.com> Fix all operator wrapping issues in leanback library.

Test: code still compiles, there should be no code/logic changes.
Change-Id: I6e97e2ba429c323022055263540c3fb6d0003822
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
62a7677a4a03aaada6ec36b73919ba418e0c886a 06-Sep-2016 Aurimas Liutikas <aurimas@google.com> resolve merge conflicts of 7373090 to master

Change-Id: I72c42608cc4b6cd214023caf42a213404f3b9e0a
99ec8b0cb375f7e5577ea3ec9f09e6ff7a95de0d 25-Aug-2016 Aurimas Liutikas <aurimas@google.com> Remove all the extra accessor methods added by javac in support-leanback.

Change private methods to be package protected to avoid extra methods
that get added to be able to access them from inner classes.

This CL saves 469 methods in our jar.

Bug: 31075707
Change-Id: I68c8152d060c9f35c72a2d78c608a9bccd12c86e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
ae746be7c46297b910a99c07697e33e3a5fd7fac 04-Aug-2016 Dake Gu <dake@google.com> GuidedStepFragment: support BACK for drop down list

Added onChildViewHolderSelectedAndPositioned when Child of GridView
is being laid out, that is required to adjust the expanded focus
item view vertical position in *one* layout pass for fragment
transition to properly run.

Add BACK key interception for sub actions list
and action with hasEditableActivatorView() (e.g. Picker)

Removed mSelectedIndex from GuidedStepFragment since we already
save/restore index in view state.

Show case in SupportLeanbackDemo NewPaymentFragment to use
setTargetFragment to pass result back to second fragment.

Bug 29901385

Change-Id: Ib856b776bc02c8cc01bf3379aa7562285c9bd41c
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
ef4e1b371215f9fffa9245159250740b611dfb4d 01-Aug-2016 Dake Gu <dake@google.com> leanback: use android attr vertical/horizontalSpacing

Follow the name convension of android, call the space between grid
item "verticalSpacing" and "horizontalSpacing". Deprecate the old
customized attribute verticalMargin and horizontalMargin.

Change-Id: Id5a1efdb9ce2f1062abd62d501869d2b0310a5c9
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
88c1cf67c6437e5e0f386b65b9e79605a111bd03 31-May-2016 Dake Gu <dake@google.com> GridLayoutManager: call focusableViewAvailable() inside layout pass

Onboard fragment layouts VerticalGridView, then starts a transition.
focusableViewAvailable() is called in a post runnable, causing a
scroll animation run together with transition.

Move focusableViewAvailable() call into layout pass, if framework
focuses to the view, gridview will align to the view in layout pass,
avoids extra scroll animation.

Bug: 28274171

Change-Id: Id348746c4d93a23527e7e829801e0a63e4622d77
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
c9a859537b0871f84afeeb706a5b425fe3f2b4dd 25-May-2016 Aurimas Liutikas <aurimas@google.com> Fix a random assortment of spelling errors.

Fix spelling errors found by Android Studio.

Change-Id: I121c79029f4e323da4ff2f44891e25480c44ebbc
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
15375aa6fd54b036f97f99229aefab2822c8a1c9 24-May-2016 Aurimas Liutikas <aurimas@google.com> Add missing @Override annotations in support library code.

Change-Id: Ifcc3a20b54d6a14b0a14aa0f48e642cf7e8c0e70
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
600d0c97c2a40f2477ad844742432dd6945806b1 19-Apr-2016 Dake Gu <dake@google.com> leanback: workaround RV focusSearch() issue.

CL "RecyclerView focus search improvements" breaks the scenario
to keep focus within RV when regular FocusFinder fails.

Returning same focused view in onFocusSearchFailed() is no longer
working since RV.isPreferredNextFocus() rejects it.

This workaround moved logic from onFocusSearchFailed to
onInterceptFocusSearch.

Bug 28246268
Bug 28256038
Bug 28270709

Change-Id: Iabe4b981c40f0282ef0d8d370669692ca612d727
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9ee42e485eaacb41a07a441be09bf94e0feec37d 31-Mar-2016 Dake Gu <dake@google.com> Merge "leanback: switch to use helper methods for margins" into nyc-dev
7874ba8942718e7bd249e65adc0baddb76dd102c 31-Mar-2016 Tony Mantler <nicoya@google.com> Merge "Implement scrollToPosition in GridLayoutManager" into nyc-dev
015eaf265571c84b5d37311f58bc69b2eb4af8d4 30-Mar-2016 Dake Gu <dake@google.com> Fix GudiedStep GridView focus 2nd try

Setting focusable in style/layout doesn't work for RecylerView,
so set the attribute in GuidedActionsStyleList.

Making grid view not focusable causing another issue: in Fragmet
to Fragment transition, fragment.onResume() does not have any item
view in the action list yet. So actionlist.requestFocus() gets
ignored. Fixing this by declaring focusableViewAvailable() when
RecylerView layout pass added focusable children.

Bug 27886380

Change-Id: Ic95db8fb60d6e6c309f5a8d45642dbe0505d457b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
ca5ab1a00298f1c1ad5227e352b8ae2e67c079a7 31-Mar-2016 Tony Mantler <nicoya@google.com> Implement scrollToPosition in GridLayoutManager

Just call through to setSelection.

Also remove extraneous parameter in setSelection calls.

b/27248919

Change-Id: I31aca71934e5ff62c468061be947c88ddaa0e42a
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e2443a93fcb82151f5290b89617b34b69442fdd3 29-Mar-2016 Dake Gu <dake@google.com> leanback: switch to use helper methods for margins

Switch to use RecyclerView helper methods with margin support.
Added test cases for optical bounds used together with margins and
item decoration.

Change-Id: I021a4f1c6c6c777845a7379fd8c23a128a13356c
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5509e275a04396bfb16b3a217c5392a864398174 25-Mar-2016 Dake Gu <dake@google.com> leanback: Fix ItemDecoration

1. We should skip the optimizaton of checking isLayoutRequested()
Because when child view's decoration changes, it will not
be layout requested.
2. calculate opticalInsets is wrong, it doesn't count the decoration
offset, so incorrectly put decoration insets as optical insets.

Bug 27794028

Change-Id: Ide4f907764a4f35507c32ba3db764f8ad4ccd090
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
936fd406f49a6fae8768084e84fa7d1beccf40a9 19-Mar-2016 Dake Gu <dake@google.com> leanback: Fix selection offset when restoring gridview

We add offset to selected position in onItemAdded, this
should be avoided before LM layout children.

Bug 27819090

Change-Id: I299832c491bff19846f1f7bacda01ecb8ea685ea
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
678a58f6a6772d955f21d1ff869f2bcd999aade3 23-Mar-2016 Dake Gu <dake@google.com> Leanback: Fix crash in navigation and removing a view

We should exclude removing view (but still focused) from focus search.
It crashes because we start searching from removing view's index in
RecyclerView which might be out of range of LM.getChildCount().

Bug 27766012

Change-Id: I6adc629dd3210abeb84072dc3f07d45b522d1b8a
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
a2aafea6e51bb33581853e16c21d546b316a52a3 21-Mar-2016 Dake Gu <dake@google.com> leanback Fix typo caused extra select event being fired

Bug 27775003

Change-Id: I4d9f693c2e42a3bc51c528d8f723de90a2da6300
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
362fda0323b85ec2379967901a0bd33a2ad4b8b5 25-Feb-2016 Dake Gu <dake@google.com> leanback: customize focusables in secondary direction

When the focus search direction is PREV_ROW or NEXT_ROW,
we fall back to default addFocusables() which basically
add all children and descendants within RecyclerView.

This isn't the default behavior desired when navigating LEFT
out of a vertical list, we do not want the siblings of
current focused item to be part of focusables list.
Because the siblings might got a higher score in FocusFinder.

In the broken case (a modified browse row moves first card to
the middle when it gets focused), sibling browse row's first
card gets a higher score than left side navigation menu because
they are closer to current focused card.

This fix explicitly handles PREV_ROW and NEXT_ROW case
and overrides default addFocusables(), it wont add siblings when
they are on same grid ROW.

Bug 27258366

Change-Id: I2e11cea7bc8e370fbda0be1dc5ccccb587a3fb43
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e2f2ff730ed20153aa006d655888190763c16d5c 17-Feb-2016 Dake Gu <dake@google.com> Fix crash: Dont fetch items in onMeasure when HasFixedSize is true

With new RV change, HasFixedSize=true hehavior has been defined as:
RV size is not determined by child size. So when HasFixedSize is
true, the items passed to onMeasure() are no longer valid and should
not be used. Though HasFixedSize=true is generally not allowed when
WRAP_CONTENT is used, add extra protection.

Bug 27202689

Change-Id: Ic1e30674588227988621f7802692a1f12eeac3d7
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
fd4ac97d700ae14ed2b4bb2f0eb6ef83c68a6966 02-Feb-2016 Dake Gu <dake@google.com> Fix leanback grid view addFocusables() when isFocusable is false

When strategy is FOCUS_SCROLL_ALIGNED, we need add the last focused
item remembered at mFocusPosition into the focusables list, so even
the GridView itself is not focusable, we could make FocusFinder
selects the child item.

Bug 26918143
Needed to fix Bug 26894680

Change-Id: I7125ea0389a0299deb7d0fd31c02a5c3dc77e74f
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3b41f91889912304ab334d97d197b51eaea7ce28 11-Dec-2015 Dake Gu <dake@google.com> Prevent LinearSmoothScroller going too fast

This applies to the cases for a spinner which only show one
item Vertically, the VerticalGridView's height is very short.
The default settings in LinearSmoothScroller will way over
scroll the views.

Change-Id: Id002bf1bc9f102ae844ad50d1946876b84df3bce
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
173d79a987bec7d8dc9fd4e7066200d0b9b9842e 03-Dec-2015 Dake Gu <dake@google.com> Fix focusOutSideStart and focusOutSideEnd for VerticalGridView

Bug: 25982172
RTL GuidedStepfragment is unable to move focus to button actions

Change-Id: I3e534753ef1d187ce2518bd60819215581dc0931
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
be6eb618b4ba8a74d69fa04c77c717b1fcbea818 20-Nov-2015 Dake Gu <dake@google.com> GuidedStepFragment: support expand/collapse sub actions.

Refactored GuidedActonsStylist.ViewHolder to be subclass of
RecyclerView.ViewHolder, since GuidedActionsStylistis already
assumes running in RecyclerView and adding scroll listener.
There is no benefit of hiding RecyclerView.

Added support to disable focus right / left in actions list
view. We don't allow focus to the side buttons from sub actions.
Also disable focus left so it won't be interpreted by a bottom
BrowseFragment as open fast lane.

Expand/collapse animation is yet to be added.

Bug 24979518

Change-Id: I4309e63347e5b85b746477f988721fd4fca67943
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
00e05297683e1cc2a5fb25a00632a778b7b5d0e4 10-Nov-2015 Dake Gu <dake@google.com> GridLayoutManager: fire selected event when selected item type changed

Not only compare focused position but also compare the focused View that might
changed in fastLayout pass.

Bug 25619502

Change-Id: Ib59c8d753224daf23667d2f6ebd9a1babad61eb4
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9a8833a689869ecdacfcc280b5cffb133ccf9f76 31-Oct-2015 Dake Gu <dake@google.com> GridLayoutManager: Dont crash in measure when using weight

Using the size passed from parent instead

Bug 24738452

Change-Id: I2692b92bf0bcd2d067a30162d1c7b3b1d6ce28ca
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
ac6a1a35cff83fdb50d9c8e203f881a54e92e40c 27-Oct-2015 Dake Gu <dake@google.com> GridLayoutManager: handle smoothscroller cancellation properly

When smoothscroller is cancelled and the targetView not found yet,
immediately jumps to the final position. Otherwise the LayoutManager
is in a bad state.

Bug 25322065

Change-Id: I3e8cce98ff218ad74c263c2f6412ba39911c7e3e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
c88e63b62bf417df87d9c14daf35d7a7e1125115 12-Oct-2015 Dake Gu <dake@google.com> leanback: use item multiple align info when calculating scroll max

This wasn't discovered because the FullWidthDetails row was always tested
with related rows and it was never used to calculate scroll max.
If there is no row after FullWidthDetails row, we need use the
last focusable view (the details descritpion) to calcualte the scroll
max.

Bug 24801632

Change-Id: Ia3345fbee2c81464a1b016c74b9c6561be551e9e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
a63d86321b1b4d09f965019e4bcb62f0d0aaa12f 28-May-2015 Dake Gu <dake@google.com> GridLayoutManager: supports decorated bounds and margin

Switched to use "getDecoratedXXX" bounds method and added support of margin.
This also makes LM available to future RV size change animation.

Change-Id: I508c9419ae9bb6b8d363164e7eacf7f29fd3598c
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
89b4aed6fcd80f940531e265936ab908a8037f87 22-Jul-2015 Dake Gu <dake@google.com> GridView: fix two focus problems

1. if gridView has a list of children and gridView.requestFocus()
is called from top-down which is a typical case when activity
created: gridview should auto focus to first focusable child.

2. When none of visible children is focusable and gridview itself
is focused, focusSearch(int) should navigate to first focusable
child.

b/22634251

Change-Id: I345119c47f0d70029e18eb8405ed67a53bc26fe8
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
91feb947412e0521a5f1835553214dcbe03fd362 09-Jul-2015 Dake Gu <dake@google.com> GridLayoutManager: fix jumping problem caused by requestLayout

When requestLayout during scrolling, onLayoutChildren() does not
check return value of getScrollPosition so it may get dirty values
from the temp array.

Bug 22209986

Change-Id: I2506d2774d2069cae86b360f8c985d2ea05cc629
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
ff3b38c570fa25327bb6a9bca1753827d9f9d7fd 08-Jul-2015 Dake Gu <dake@google.com> GridLayoutManager: Fix scroll bug when target view is removed.

When item is removed, we should stop scroll animation and scroll to
a new focus position or same focus position of different item.

b/21970393

Change-Id: I3917adbbed7dd1599f93a5459c7f4bfc3bbac7c6
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
d1cab1b54104d55407335c5d649398635822fffd 24-Jun-2015 Dake Gu <dake@google.com> Leanback: support Scroll Accessibility action

Behaves differently than phone/tablet, it scrolls to
last/first item on the same row for SCROLL action.

simplify the dispatchChildSelection() in SmoothScroller
a little bit: only dispatchChildSelection() for the
final target.

b/19072385

Change-Id: I543e5298c681e3809d87de767ec3ab93ef6fe15c
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
8c5713428379689839330c344c4a800039db0400 23-Jun-2015 Dake Gu <dake@google.com> Merge "Supports extra layout space" into lmp-mr1-ub-dev
88dea72af6042049560140a70e059820dbb8f746 19-Jun-2015 Dake Gu <dake@google.com> Supports extra layout space

When layout reordering aligned focused item, extra space is
needed during prelayout for filling. However there is no
general solution now based on REMOVE/CHANGE flag of ViewHolder.

This CL is a case-by-case solution allows extra item to be added in
invisble area so that item animator can animate slide-in instead of
fade-in.

b/21949401

Change-Id: Ic78a0d639f387a0bf319fcc504b8401262148a0b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
f923d595ace34894c49d1609d3c629336b175b89 17-Jun-2015 Dake Gu <dake@google.com> Leanback: use SingleRow for most widgets

Use a simple SingleRow module for single row case.
Improves both memory and cpu.

b/21898578

Change-Id: I7aa235d343c87a87e66bac4d3209a194262e6e87
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
0246318f27a905a31df5a8af445cfe67d31dfb68 15-Apr-2015 Dake Gu <dake@google.com> New details fragment design

Added new FullWidthDetailsOverviewRowPresenter and changed
DetailsFragment.

Under new design, details fragment is responsible to setup
alignment for each row.

Details fragment is also responsible to change the view state
of row based on selected position and selected sub position.

There are three states for the overview row:
STATE_FULL: covers full width and full height(may be customizable).
STATE_HALF: has empty space in the top to look through.
STATE_SMALL: a banner style like the old Details.

The layouts for different states are defined in the new
FullWidthDetailsOverviewRowPresenter.

Made the logo view presenter exposed and replaceable.

Decouple SharedElementHelper from FullWidthDetailsOverviewRowPresenter
to make it possible to customize shared element transition.

For the apps: they only need switch to use the new presenter.
The old DetailsOverviewRowPresenter is still supported at this point
but might be removed in the future.

Support customize or disable title of DetailsFragment.

Fixed api/current.txt: Hide GridLayoutManager.

Change-Id: Id53aa5a185f132c8d74c95042595f223371fa708
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
db0b1afb71440b79923692d58adee982b5954838 29-Apr-2015 Dake Gu <dake@google.com> fix bug of wrong selection when itemAdded is triggered

When items are added at the same time that setSelection()
is called, we incorrectly apply the offset to the position that
user wants to select. Disable the offset when target view
hasn't created yet.

Bug 20672263

Change-Id: Iaf990b58109d005ef04d9a47029e5c0a493bb8c3
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
08c56822b71ab0aa0b9bb03e5fd45e28f6e358b8 28-Apr-2015 Dake Gu <dake@google.com> Revert "Revert "Support multiple alignment within one ViewHolder""

This reverts commit bc0edc3ab9bac3c8d7d3cc9de1cb499ea3b4155e.

Change-Id: I1f9540e54fdee874adf7239a0ead1fb5447f2610
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
bc0edc3ab9bac3c8d7d3cc9de1cb499ea3b4155e 27-Apr-2015 Dake Gu <dake@google.com> Revert "Support multiple alignment within one ViewHolder"

This reverts commit 86a6309c3e89ec6abc40ec045bfaef7827cbe427.

Change-Id: I3385d74766e948566b7321cbe2afcf31a66282c1
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
86a6309c3e89ec6abc40ec045bfaef7827cbe427 07-Apr-2015 Dake Gu <dake@google.com> Support multiple alignment within one ViewHolder

Add support of align to multiple positions within one ViewHolder of
Grid View.

Introduce "FacetProvider" inteface for optional features to be implemented
without requiring an object must implement a java interface. Benefit
is less impact on the major feature of a class, make the extra optional
features loosely coupled with existing class. (And it is the only way
for ItemBridgeAdapter to provide a list of optional features that
are implemented by some Presenters but not others)

Add a new ItemAlignmentFacet class to describe multiple alignment positions.

Grid view gets optional ItemAlignmentFacet from RecyclerView.ViewHolder(rare)
or RecyclerView.Adapter for a given view type. If the facet exists, it's used
to calculate multiple alignment positions within this ViewHolder.

At high level, for apps that using Presenter, they don't directly use
RecyclerView.ViewHolder or RecyclerView.Adapter. apps put Facet in Presenter
(most cases) or a ViewHolder(rare cases). For example in the new detail page
design, DetailsOverviewRowPresenter will need this facet(TODO),
ItemBridgeAdapter is responsible to "bridge" facet from Presenter.

In the future, Facet may be used to customize child view state saving.

Bug: 20094419

Change-Id: Iabef94e46f9a304ffd68e49bed10e74a57dfe4ce
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
f8bac02be73439a0aa4f2ca88490e27af0efe893 04-Apr-2015 Dake Gu <dake@google.com> Use the recyclerview fix of child state saving

No longer needed it since RecyclerView fixed it
in b/20061783. Test case passes with RV fix.

Bug 20016293

Change-Id: I53407d98125b86fe274ea1e0d7856d32f5ca4bc5
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
61e5a56ed066815e69be7526e3d1bee2d5268d20 01-Apr-2015 Dake Gu <dake@google.com> GridLayoutManager: fix child states incorrectly saved

We already handles child state in LM.onSaveInstanceState(). But
ViewGroup dispatchSaveInstanceState() and dispatchRestoreInstanceState()
directly invoke child view's dispatch methods without going
through onSaveInstanceState(), so it saves states that we don't need
and later being used unexpectedly in dispatchRestoreInstanceState().

Disable the dispatchXXX() of child by toggling the flag
when a child view is created.

Bug 20016293

Change-Id: I599515ac8a0bfe29b7abef190509ef464fd2ccb6
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3bd331ac6fe8ef25a2deb3559b0b5958573c231b 26-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager Fix child state restoring bug

A regression of ag/630154: detached and reattached child is
assigned with obsolete state saved at opening activity.

The (correct) logic is now:
1. Child state is saved when child is unbound (onViewRecycled)
2. When being asked for onSaveInstanceState(), copy the states
saved in (1) and save current onscreen views state into bundle.

Bug in ag/630154 is that in (2) we saved onscreen views state in
the GridView offscreen states and that information can be invalidated
after a while (e.g. selection of a row can change) and it's later
incorrectly used when a view is detached/re-attached.

added test case.

Bug 19937291

Change-Id: Iac6bd849fdd9755471bce6c7763316d0264cc7a2
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
1a5a2c58890e69b0554a82f22e3c0d1ffb238366 25-Mar-2015 Dake Gu <dake@google.com> Fix crash when calculated secondary size is 0

If for some reasons, parent of GridView asks to measure with 0 secondary size,
calculated mFixedRowSizeSecondary is zero and the array for maintaining the
secondary size of each row is also null. Then processRowSizeSecondary()
will crash.

Bug 19930906

Change-Id: Ifa45ee94cda133830a0e78b563df5edeeaff9c3f
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
492506cede17ecee39ce7fa35ee7a347ff31c5ba 25-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix size change not detected

When rowHeight=wrap_content, onMeasure() will measure
the child's size. So when fastRelayout is run, the
measured size is already new value, it should not be
compared to decide wether there is a size change.
Switch to use the correct view size method.

Bug 18537143

Change-Id: I084e54ba45cbb1a79fe67b65d064843035d3abf4
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
c0b265dd2df42b399ba1f959b3dfd14dd14012b5 25-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: Fix focus bug

During layout, when a view already had focus.
Should not call requestFocus() again which might
change the focused child within it.

Bug 19828044

Change-Id: I97074469d9e4fbcc8f45cd8c738200b7faba00a5
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
57f5baa07260dad2a9641e9ceb80567ce2784e9a 21-Mar-2015 Dake Gu <dake@google.com> Fix setNumRows gets ignored

setNumRows goes through onMeasure() then onLayout().
Before the onMeasure() gets called, another onLayout()
clears the mForceFullLayout flag without knowing
there is a pending numRows change not handled by onMeasure()
yet. When 2nd onLayout() gets called, it doesn't go to the
non fastlayout pass.

There is no need to set the flag when change num rows,
comparing with grid row number can decide if goes through
fast layout pass.

Bug 19872498

Change-Id: Ia5254a49e24be04665a1e5175355827a5dfa7258
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3a7aa9cd68bd39f3a843291817dc209d1d9a45aa 20-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix bug smoothscroller gets interrupted

Vertical scroll in Videos app is janky.

During VerticalGridView scroll pass it appends a row and layout
the row, the row layout might request focus on a child, that causes
a onRequestChildFocus() call back into the top level VerticalGridView.
In that case high level verticalGridView should not start another
scrollToView() animation. onRequestChildFocus() is supposed to handle
user's interaction only.

The bug is difficult to test, both RV.smoothScrollBy() and LinearSmoothScroller
uses the same scroll state, calling RV.smoothScrollBy() does not
stop linearSmoothScroller. Added a override class to intercept calls
on RV.smoothScrollBy().

Bug: 19846906

Change-Id: Ica857f443e41f14710b2bf177eafba30403817c7
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
7538845719cd1e588185ce9ae60320377862ef8d 19-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: Fix ANR

Regression of fixing b/19625410
We are trying to add non-existing focused position view in fast
layout pass and ended in a deadloop.
Switched to a different fix for b/19625410.

Bug: 19823374
Change-Id: I9fd1e985c09f8deffb46285366b5cf97d881c1b9
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
f80ef0d6b0b6403f3cd94e7197bc4a39d285280a 07-Mar-2015 Dake Gu <dake@google.com> Fix missing dispatchChildSelected() for staggered grid

This bug does not happen to single row grid where we
change mFocusPosition before createItem.

For staggered grid, when scroll up to item 1: we first
create item1, then consumePendingMovesAfterLayout() changes
mFocusPosition to 1; the event is not fired in createItem
and it's not fired in smoothscroller onStop() if mPendingMoves
is 0.

Bug 19620864

Change-Id: If90fa1b11f7ba689015ecd5462482b83254f345b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9c56475370d1df940252ff1360b92de50022fff6 06-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix fastRelayout() not focus to added child

When items are added to empty GridLayoutManager, it triggers the
fastRelayout pass which does not set focus position to 0.

Bug 19625410

Change-Id: I2ce11abde2162bb7fd28fd1fa6343b9d9b6b32f1
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
8c5d3b45f6afa838e64e4cf011a385c191d557c6 04-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix crash and support scroll delta.

Fix crash of setSelectedPosition.
Add scroll delta that applied to setSelectedPosition.
Moved updateFirstVisibleOffset into StaggeredGrid class,
the offset is now calculated when inserting first visible item,
because the offset is needed when we append next visible item.
Fixed a loop variable bug in updateFirstVisibleOffset.

Added test cases

Bug 19272838
Bug 19593908

Change-Id: Ibb6f2e115e9e4af6a2b18a48a921e6766cd0c0a6
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5c13a7806aa6c44e9711beb98797d06f3b2f0259 03-Mar-2015 Dake Gu <dake@google.com> GridLayoutManager: fix focus lost in fast layout

In fast layout, if there is delta, we unapplied delta first, which
may cause the detached focus child move outside visible area and it's
not added back at end of fast layout. And another rare case is
that child layout changes causing focused child being pushed outside
visible area.

Bug 19573463

Change-Id: Ib096bf68f57c32ce8d8ecd13621e0ab35719949e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
6b22c4c875d7a540e705b2b6b65bf52c7a89299a 28-Feb-2015 Dake Gu <dake@google.com> Dont scroll to non-focusable items in onLayoutChildren

Added test cases

Bug 19283027

Change-Id: I1de48881dfc4117a42a7e74722f3cc4607f25a51
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
6834e168743e839d4df1bc49ba625cfbb74e1045 23-Feb-2015 Dake Gu <dake@google.com> Merge "Do not scroll to non-focusable item" into lmp-mr1-ub-dev
77b17ebed6d1f8488b150b25e2b6754971480cae 10-Feb-2015 Dake Gu <dake@google.com> Do not scroll to non-focusable item

Refactoring to use same PendingMoveSmoothScroller for both
staggered case and non-staggered case (RowsFragment vertical).
The problem of position based linearsmoothscroller is that
it calculates target position before the view is created;
so we may scroll to a target position that is not focusable.
Now using PendingMovementSmoothScroller, added a callback
consumePendingMovementBeforeLayout() where we skip the view
that's not focusable.

Allow dispatchChildSelected() during scroll pass, so we can append
an item with selected state without running another layout pass if
we apply select status after laid out it. This requires a change
in StagggeredGrid to make data structure consistent before
dispatchChildSelected() call. To avoid excessive dispatchChildSelected,
we postpone dispatchChildSelected() if a PendingMoveSmoothScroller is
still running. We only dispatchChildSelected() event on the final target.

Fixed a problem of unbind RowView does not apply animator end value.

Added TestCases

Bug: 19283027

Change-Id: I5cab61420514b5d0141387aa13a18d623b38536f
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
f9eda43e5076035aba504a315d1797d2d918d12a 20-Feb-2015 Dake Gu <dake@google.com> GridLayoutManager: recalculate scrollMinMax properly

We need invalidate scroll max when last item is invisible.

Bug: 17472458

Change-Id: I4876ff83e24e91485d73e1eb84d527a8139e82f4
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9e0a5a45e54dab959e171b1c82f5f07a82c7d0fc 30-Jan-2015 Dake Gu <dake@google.com> Save viewstate in onViewRecycled()

Detach and attach can happen a lot in layout.
Saving states when detached is not necessary.

We only need save state when view is unbound from data
(in onViewRecycled).

Bug: 19202006
Change-Id: Ied07a123eaca41b42e828b6fda0003e4e4e0ee8b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
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/GridLayoutManager.java
85df3117f0fcd0aa10d7bd45194dab97e22112f2 14-Jan-2015 Dake Gu <dake@google.com> Fixed three bugs causing redundant remove and append

1. When checking overlimit, should take margin into consideration.

2. Fixed a bug in findRowMax, should only use edge of last item in that row.

3. appendItems should check overlimit before add item when oneColumnMode is
false, both withcache and withoutcache.

Also added test case for move items

Bug: 19017080

Change-Id: I6594c9158b186449739eb284c4607df7803e2049
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3a23ad69eef2b92be38f9704e064600066b7dfe9 13-Jan-2015 Dake Gu <dake@google.com> Fix lost selection of browse row

Workaround problem of getAdapterPosition() returns -1 in onChildDetached()
in layout pass (created b/18960075)

Issue: 18984910
Change-Id: I3906daf6d68b492c6aefe1007eb8c795da45c5f5
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
6e96b9d46e7af6bedf6213ecc2ba0ad7b8050778 18-Dec-2014 Dake Gu <dake@google.com> Refactoring grid algorithm

The current interface between GridLayoutManager and StaggeredGrid is
too complicated: GridLayoutManager updates rows min/max edge and Grid
is responsible for fill items according to row min/max edge.

This CL moved most of the grid code into Grid class family and make
interface between GridLayoutManager and Grid much simpler.
GridLayoutManager no longer updates row min/max.

Refactoring made it possible to write efficient Grid class for single
row or non staggered grid. A base Grid class is abstracted out.
StaggeredGrid implemented it using a complicated data strurcture (a
CircularArray) to cache stagger layout result. A single row Grid will
cost less memory allocations: a TODO in the near future.

fastRelayout() was rewriten slightly differently, it will relayout
(using detachFromParent and attachToParent) next children once detects
child size change, previously we push children away on the same row
which might cause a bad alignment at end.

Regular layout now starts with detachAndScrapAttachedViews(), this
is lighter than removeAndRecycleAllViews() which may lose some views
due to cache limit.

Prepend/append during scroll now also detects if child size changed,
then invalidate cached staggered result before/after the child.

Improvement during adapter notifyChange or structure change, now we
no longer discard grid information in a non-fast relayout case. We
still keeps the same cached staggered result, until we really find
size of a child has changed then we invalidate part of the cache.

Tested with BrowseFragment/HorizontalGridTestActivity/
VerticalGridActivity/BrowseAnimationActivity and with rtl=true/false.

Issue: 18946733

Change-Id: Ia0cfa34ad8d09c124dbffe51680a89f177bfef31
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
dda08cebca092380021dc6277bb32c0e4da16fec 19-Dec-2014 Craig Stout <cstout@google.com> Add systrace events.

Change-Id: Ic90e8cfa26df4e74d68248e878cdba552e13597e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
100e37bdec64de77f82ea19e88e74a0fd842b119 13-Jan-2015 Craig Stout <cstout@google.com> Merge "Handle child layouts due to child selection." into lmp-mr1-dev
697886fa2541e4e1223396d38329451e9e83d08b 13-Jan-2015 Craig Stout <cstout@google.com> Merge "Fix browse fragment smooth scrolling." into lmp-mr1-dev
597f620c2503bb18aabf0b6fe4c0c84ab7b42cba 08-Jan-2015 Craig Stout <cstout@google.com> Handle child layouts due to child selection.

b/18840332

Change-Id: Id70b6ea3c21e00be8529cc4ba59aafc1b67b10ab
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
f185bcb93b28f5e81b88405445157a2b53a2d1c7 22-Dec-2014 Craig Stout <cstout@google.com> Fix browse fragment smooth scrolling.

In most cases (During layout and when smooth scrolling) we shouldn't add
items until they have scrolled into the window.

On focus search fail we should add items immediately; however the modified
methods are not part of that code flow.

b/18742856

Change-Id: I83bbc583a7809e65ed930353aa804bd95b362eee
(cherry picked from commit e3cbb083dad7a70b26f542b7bb5d7b67a8c8621e)
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3f23b01f1e22f971e2105557137927822e7419f1 19-Dec-2014 Craig Stout <cstout@google.com> Fix scroll controller initialization.

b/18742856

Change-Id: I00429638e1ce1e2e9fc7b7d5aa7b474c9945f155
(cherry picked from commit 2ced342a1b5cf07415825f7f5bae26f012b3832e)
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
ceb323a31b16a5ee227c7e68f147b86bf7bfa639 11-Dec-2014 Dake Gu <dake@google.com> Fix GridLayoutManager initial append/prepend logic

Bug 18718926

Change-Id: I2658f3363a8258b03be4d3286d0f44ca2f55e2fa
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e0e66a21916f94ebbced0d1ffe3dc652c9c7a15e 10-Dec-2014 Kris Giesing <kgiesing@google.com> Fix various RTL issues related to multi-row grid views

Also fix some RTL issues related to grid views that do not wrap content

b/18631342

Change-Id: Ibc52057375c24409dacd7af3fb1e487d022b9ff8
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e36b890d49e33f38eada22a0d9f84974bda2ddb0 09-Dec-2014 Craig Stout <cstout@google.com> Merge "Reset scroll when all items removed." into lmp-mr1-dev
4a6588a5160206fc7063e5a140a405dfd84f0cc9 08-Dec-2014 Craig Stout <cstout@google.com> Reset scroll when all items removed.

b/17575336

Change-Id: Ie5038b6893051a3a83e999bbcd8b64c170880083
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
7db64bb839e5589b38322f9f7456cb928ffc2c1c 05-Dec-2014 Dake Gu <dake@google.com> Fix end alignment of grid

And simplify and take out reverse handling from WindowAlignment.

Bug: 17953835

Change-Id: Ieebed8c1f7b4f5664462f0db210865b60cecd3e9
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
8f51aa01152a33d489471bc7c667b39cc2062706 26-Nov-2014 Dake Gu <dake@google.com> am 9036a735: am 02582d90: Merge "Leanback: fix crashes of setScrollEnabled on empty list" into lmp-dev

* commit '9036a735b00ebcaada5981ff607a598439e52662':
Leanback: fix crashes of setScrollEnabled on empty list
02582d90a07220d14ae199fa208f0ba30280afd2 26-Nov-2014 Dake Gu <dake@google.com> Merge "Leanback: fix crashes of setScrollEnabled on empty list" into lmp-dev
d633c87b6565c6068a5c5beb5a1ef91a493acea8 21-Nov-2014 Craig Stout <cstout@google.com> DO NOT MERGE Fix crash when focus requested on a child that was removed.

This can happen when all views are removed.
This a regression triggered by a cherry-picked of recyclerView change ag/582987

b/18474947

Change-Id: I1b9c4b82488a893ba7e668cdc79e41a03d7c61a2
(cherry picked from commit 9b68e453d30984d524dcf25fdc2e645ae853ac33)
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
475d474909f8e7ed27caae527997d74bf4f8a307 21-Nov-2014 Craig Stout <cstout@google.com> Merge "Fix crash when focus requested on a child that was removed." into lmp-mr1-dev
9b68e453d30984d524dcf25fdc2e645ae853ac33 21-Nov-2014 Craig Stout <cstout@google.com> Fix crash when focus requested on a child that was removed.

This can happen when all views are removed.

b/18474947

Change-Id: I1b9c4b82488a893ba7e668cdc79e41a03d7c61a2
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
8e3566285de4ac771d6188f62fe947e23d371a3d 19-Nov-2014 Kris Giesing <kgiesing@google.com> Changes to support RTL layouts

Bug: 18020272
Change-Id: I3e07b5f3784303b0b50dccc72d9d5ab140ea158f
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
b008e4b45faf7c1ece57e48a3517520d65e3b8ca 20-Nov-2014 Dake Gu <dake@google.com> Leanback: fix crashes of setScrollEnabled on empty list

b/18449655

Change-Id: I362433c679f46eb5565d12251db0c24421e3fb55
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
42f8a879beb54fd181c588b78554367d947ec48b 20-Sep-2014 Dake Gu <dake@google.com> DO NOT MERGE Leanback: Finish implements overreach feature

GridLayoutManager Overreach feature is not quite right yet, a diff of
alignoffset * (1 - 1/scale) needs to be applied.

And we may need overreach for views other than gridlayoutmanager.

Move all the functions into a ScaleFrameLayout,
so that it can scale any type of view, not just gridlayoutmanager.

b/17914987

Change-Id: I99e0711041a2115b3ed1bce29e7a021b2a2132bd
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
571796b3ae0c5e15d9324a61745506b5ba47682c 28-Oct-2014 Dake Gu <dake@google.com> DO NOT MERGE GridLayoutManager: Fix crash in onMeasure

mFocusPosition is not in range in onMeasure() which
is executed before onLayout()

b/18153129

Change-Id: I0fc94caca64e8ccf0ab439b9fd44eca500fb6bd1
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
d1911befd5509ac5ba188559eab193291bedb4ed 17-Sep-2014 Dake Gu <dake@google.com> DO NOT MERGE GridLayoutManager: fix scrolling glitches caused by interference of transition

disable scroll of animation initiated before transition started and restore the
scroll animation when transition is done.
Disable focus out in scrolling.

Bug 17551262 Wrong item position in row
Bug 17549016 unexpected horizontal scrolling is running after we go from content to fast lane

Change-Id: I2d7acbafad415436ad7200b17ad31e2ac0e6a6d8
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
1f000f84b9f8db8778b941a6a1bf60f3d349545d 20-Sep-2014 Dake Gu <dake@google.com> Leanback: Finish implements overreach feature

GridLayoutManager Overreach feature is not quite right yet, a diff of
alignoffset * (1 - 1/scale) needs to be applied.

And we may need overreach for views other than gridlayoutmanager.

Move all the functions into a ScaleFrameLayout,
so that it can scale any type of view, not just gridlayoutmanager.

b/17914987

Change-Id: I28d073b39eba9c0d24093274b2f5a524e3381aa9
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
80d061649db1d8e5c69f400fef4d61e2fde9dd3b 29-Oct-2014 Dake Gu <dake@google.com> Merge "GridLayoutManager: fix scrolling glitches caused by interference of transition" into lmp-mr1-dev
2986af93ba272bdc69d414bdcf5fcf0901c8ee97 28-Oct-2014 Dake Gu <dake@google.com> GridLayoutManager: Fix crash in onMeasure

mFocusPosition is not in range in onMeasure() which
is executed before onLayout()

b/18153129

Change-Id: Ie156072b284098e671e4b90e0fad574c263a1fdd
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
7a52e206fb20167f0b7e7a9daa7abb952d5f544d 30-Sep-2014 Dake Gu <dake@google.com> Fix NPE caused by incorrectly calling detachAndScrapViewAt

b/17702252

Change-Id: I48456ba7a970237cb218351f3b184ef680b8c65f
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
7cd2deb3bb7af14abdb5cc9500f3638ce0af2eea 17-Sep-2014 Dake Gu <dake@google.com> GridLayoutManager: fix scrolling glitches caused by interference of transition

disable scroll of animation initiated before transition started and restore the
scroll animation when transition is done.
Disable focus out in scrolling.

Bug 17551262 Wrong item position in row
Bug 17549016 unexpected horizontal scrolling is running after we go from content to fast lane

Change-Id: I4c7d14f1e60b70984745c1ab9f55748d9abcc5aa
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
db6a0d1b5f4c0353d168fd5b22661246d23aa206 24-Sep-2014 Craig Stout <cstout@google.com> Fix onAdapterChanged.

Don't reset potentially restored state when the old adapter is null.

b/15696646

Change-Id: Ibc311fb62ad87ad35e0a98ed4f95f30aab752544
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
16d71295acfe8e8808df57db6747049c121c1512 18-Sep-2014 bulic <bulic@google.com> Fix for installs hanging on launcher

If an item is made invalid by changing its viewtype, we need to detach
and readd the view to ensure a new viewholder is created and bound.

b/17517359

Change-Id: I701b24a57d27c6c3b4569b80959cb2a315a2857c
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
0fff85d7f9dee67ec5116f3cba4e8b3961f805a7 11-Sep-2014 Craig Stout <cstout@google.com> Scale rows when headers are showing.

b/15887467

Change-Id: Ib7a942c7de6f7bdfef08ba8ef8e938abee585358
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
2024f694e8ae778eefb3f6b6cdc245a67975436c 09-Sep-2014 Craig Stout <cstout@google.com> Merge "Fix double layout framework warning." into lmp-dev
d7618ab69ef591dd5342b9481c4954bfc7e9110c 08-Sep-2014 Dake Gu <dake@google.com> Fix fading out children not moving with parent

Don't remove child of listview, switch visiblity instead.
Removed children will fade out at original position but not moving
with parent.

b/17423570

Change-Id: I253bdbadeefb71ced6971d446a17d96d7a96dea3
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
b33714d135e006cf3bdba09788c27d4791b8632e 07-Sep-2014 Craig Stout <cstout@google.com> Fix double layout framework warning.

When in layout, invoke the child selected listener before child layout.

b/15446050

Change-Id: I5d123d2586bdb55a410365a38146d1310fbfbe8a
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
14d54b35a8927e7b116ab8fa6ac621ecfcbe4bb0 29-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: fix selection offset problem

When user calls "setSelection" *before* add items
to the adapter. The mFocusPosition is already set to
the position, then adding more items will incorrectly
add offsets to not yet created item. We should not
apply pending offset in such situtation.

Ideal fix is that: user should add all items to the adapter
*before* set adapter on the view.

b/17331101

Change-Id: Ic07b68874c3742e6d29275a1c5921fa8afc08011
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
1102fc6fafe721522f2b67f86d89feda87096265 28-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: Multiple fixes to state saving

1. Implemented a LruCache based child states to limit the memory used.
2. When adding/removing child happens, clean up all cache (will lose all offscreen
child view state). This is because we use index as key, which will be changed.
3. Evict item cache when item is changed.
4. Make saveChildren policy API of BaseGridView, only the vertical list
which has nested horizontal list turned on this feature. This is quite
reasonable assumption: only save the nested horizontal list's focus
index but no more deeper children states: less expensive and avoid
potential unknown problems.
5. load children states inline instead of requesting layout, fixed bug
that requestLayout gets eaten by a top level scrolling layoutmanager.

b/17212513

Change-Id: Ic60c7ac216fa265b64646c3072767983eeb02653
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
b300ce0dfc3ad41fd6fef25833dfe4b14d5261d2 28-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: fix alignment when refreshing new data

b/17309152
b/17307859

Change-Id: I78825aefbeca6302594ac397bfe0acb27df46027
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
81a36a4dd93bf2f14c2eb88ae01464f85ddb0706 27-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: forget child view state when there is a change

b/17212513

Change-Id: I6bd73fab467d109fcdcb1d9664fe6c1a5fdf8acd
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
536b1a299d5fa25bf55c3543719b123aaaaafca3 25-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: fix layout from non-first column

Fix problem when layout item from non-first column.

b/16824116

Change-Id: I26a1cd9ab7c7b6309709d9bf57b6b0bc624bcc8f
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
906659fc65e7b8b1bc9f0c7cc3dabf7e64e8b9bf 22-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: support nested onSaveInstance()

This goes beyond just saving selected position, in order to support
dynamic 2D list view (list view of list view), LayoutManager needs
maintain a position/id to View state Bundle mapping for children.
Child view will be saved when they are offscreen and restored when
showing on screen.

b/15702302

Change-Id: Ie48300684945ee3adacc042e73d06a411287e6d1
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
1eb6cc286944b1e2f60decdf6432e5f780092c94 21-Aug-2014 Dake Gu <dake@google.com> Merge "GridLayoutManger: fix setSelectedPosition is aligned to a wrong position." into lmp-dev
e692c096892075c6ac5cf509f118df6b618edecc 21-Aug-2014 Dake Gu <dake@google.com> Merge "onLayoutChildren() should not interrupt SmoothScroll" into lmp-dev
801d8b7bc960a5ae4b0e23af8ac5b8b81f8ad6f3 21-Aug-2014 Dake Gu <dake@google.com> GridLayoutManger: fix setSelectedPosition is aligned to a wrong position.

setSelection calls scrollToView(false), which offset children's location and
switches focused child which incorrectly triggers another not needed scroll
animation. The extra scroll animation causes "over" scroll amount.

Also fixed row not being highlighted if people calls notifyChanged() and
setSelectedPosition(1) consequently, the mSelectedViewHolder is set to the
selected row 1, then an immediate onLayoutChildren() detached and reattach
all rows, which clears the selected state of the row, but
mSelectedViewHolder is still referring row1, and skipped a selected event
fired from onLayoutChildren(). The fix is to clear mSelectedViewHolder
when view holder is detached from parent.

b/16681515

Change-Id: I61a8efde46327853a2ed67af63fa125d5426f907
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
314e0698cf026f83cb9d7ff13ae31cd913845604 20-Aug-2014 Dake Gu <dake@google.com> onLayoutChildren() should not interrupt SmoothScroll

Avoid align to focused view if it's in smoothscroll.

b/16659420

Change-Id: I294fd3bff21bd78a4335e091e68c6a3982d7f50b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
8b6327deb6bbacc335b098894cbbbdc1060310f0 20-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: handle padding change properly.

When we change the padding, we are expecting child views
to offset their left/top position. Since fast layout position is
based on scrolloffsetprimary/scrolloffsetsecondary.
Changing the padding should also update the scrolloffsets.

b/17135547
b/16320658

Change-Id: I15d90e7bc96884157a7f509f29aa17630f546e00
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
72bcfa039b9278617c9efb0ebf61c3b92694110b 19-Aug-2014 Dake Gu <dake@google.com> Merge "fix bad alignment after item was removed" into lmp-dev
d2104835a233e64b3b90182913542e58276aeb47 19-Aug-2014 Dake Gu <dake@google.com> fix bad alignment after item was removed

b/16657786

Change-Id: I1a00a035175950d77cbc6d349898071290ce397e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
d182feca369cfefe1cedad624ead716a99cca713 19-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: Tracking selected position change when adapter changes

fixed b/17087493

cleanup and remove unused prelayout code.

Change-Id: Ia2a4adfe73600931a678ec6dcd2c4a6d15dfec99
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
630f82ae5e6b9c500d20ea4db4ce44a604c7e8eb 15-Aug-2014 Dake Gu <dake@google.com> Merge "GridLayoutManager: smoother scrolling" into lmp-dev
dafdf6a770fb84c1228f442db64550aae6fc11ae 15-Aug-2014 Dake Gu <dake@google.com> GridLayoutManager: smoother scrolling

Use SmoothScroller when scroll to offscreen items.

b/15546722

Change-Id: I4d8abba9a376771993bc0bcff09d86b340baed69
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
709bb7083a089e788d84ffa81f2c4f60a1bc8cf2 15-Aug-2014 Dake Gu <dake@google.com> Prevent recyclerview scrolling in transition

Both scrolling animation and ChangeBounds animation will change the card
position and cause card being put at random position.

b/16952270

Change-Id: I628230e32088cc9bb43908f9076a32877c685bd0
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
502e6531c4ee86b6671cd692bd3e2d0ffd5d65c4 05-Aug-2014 Craig Stout <cstout@google.com> Fix for measure when views have been removed.

b/15919486

Change-Id: Ib85e72d0dbabac985a33aa714f51082af37c3eab
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
f2df33adb72d7a4138d00128bf66751ad77ecaba 28-Jun-2014 Dake Gu <dake@google.com> Merge "Use ViewCompat for postOnAnimation"
49c83b12201dde5b93d4eca3d44478e0c967a2e6 26-Jun-2014 Yigit Boyar <yboyar@google.com> Pass recycler to LayoutManager#onDetach callback

Bug:15736907
Change-Id: I6cd50800ebae0ff10b99665fcda77b0da411065c
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e3582bec2e51351a3116612ad529d7eb29a82bb7 27-Jun-2014 Dake Gu <dake@google.com> Use ViewCompat for postOnAnimation

Change-Id: Ia1013fc3830258eb6f3a7d4dd9db664597ce18ac
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3de146291132c3d463941e34f0609a3dd15d6784 27-Jun-2014 Dake Gu <dake@google.com> Fix NPE when detached RecyclerView schedule onLayoutChildren()

b/15911289

Change-Id: I99ef70d585147f7f8d8a9d0923e8e667fb780d19
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
d2fd82409150a29da24eb97009d1fa59ec0a0f07 19-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager clean up code never used

Change-Id: I46660343b16ad5eb6e811175181656f4654080c1
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
08a42433300b4617bad27bda1214e12ca7854adc 11-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager: Fix WindowAlignment algorithm

The current algorithm makes assumption that if the scrollCenter of a view
is before the middle point of window, we will align the first item to
start edge. This does not work if the first item is too large, e.g. in
Search, the item's center position is after the middle point of window.

The fix is to add more flags for algorithm so if it's first item, it should
always be aligned to start edge of window.

b/15547766

Change-Id: I81f8b68c1739b7df1fa08d94d3a23b6c9e495747
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
94920246f7f5a0d4dae794058020cd67c5701056 10-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager: Do not declare predictive layout support.

Because GridLayoutManager hasn't done any predictive layout,
it shouldn't declare support it. Use a different way for
enable/disable itemanimator.

Bug: 15542012
Change-Id: Ieb71f4badb56496c20c043e55043e5e5d1eec1da
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
c35968d173f900d8024bdf38174e2225c9a7f311 28-May-2014 Chet Haase <chet@google.com> Enable simple automatic item animations for RecyclerView

RecyclerView now has automatic animations for add/remove operations requiring
no changes from LayoutManagers. This approach, which is enabled by RecyclerView
having a non-null ItemAnimator (the default behavior) and LayoutManager returning
false for supportsPredictiveItemAnimations() (the default behavior), enables
LayoutManagers to run normally, with only one layout pass and requiring no extra
logic to predict placement of appearing or disappearing items. Appearing
and disappearing items will simply be faded in/out, since the RecyclerView lacks
the knowledge or where to animate the views from/to.

Issue #15542012 Simplify RecyclerView animations

Change-Id: I6219210c9b0ca32535182c1d233076a355fe0671
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
66ae15f5fa8b6714fa78e6d3f94fe85af06ddabd 07-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager: fix some animation jumpiness

Looks like a typo that cause secondarySize is not updated in onMeasure()
and later a posted Runnable update the secondarySize.

Also focused item maybe out of bounds if we scroll really fast. So
we should measure every child.

part of b/15413508
b/14885970

Change-Id: I7478ea39f1fb429f483b5f25b69118b66c086c21
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
911b1d9ec87dcaa9b4a5a3d4e13c54f21bf03398 05-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager: fix NPE when adapter changed in scrolling

Seems like when playback activity pops, the adapter was changed
but scrolling task is still going on.

b/15004615

Change-Id: Iea86e0b9b582c3e0e0f3a435aa5092173642672d
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
2a4917392556a63a0d4d3d8ecbc55780e6e5303b 05-Jun-2014 Dake Gu <dake@google.com> Merge "GridLayoutManager: fix scroll bug" into lmp-preview-dev
6ef7396cd226efcce83389c5107166c121e25785 05-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager: fix scroll bug

When we try a possible new maxScroll we need try with the newEdge.

b/15449400

Change-Id: Icb111eabb988538923b88f4bd52bb27ec7680929
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9020c0aec57b4e8994d66b7cd1a89c225e9bfa11 05-Jun-2014 Craig Stout <cstout@google.com> Fix VerticalGridFragment focus navigation and title transition.

b/15432740

Change-Id: I6ac533a88d8ce8b17aa28d3605e688536bfbb8e5
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
01d63e7d432a412718d7c8a28b558744a372abcd 05-Jun-2014 Dake Gu <dake@google.com> Merge "GridLayoutManager: scroll limit check" into lmp-preview-dev
79b86b227e6794937ec311522b50e727f8eec263 04-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager: scroll limit check

ScrollMin/Max are only updated when we added first/last
view or where fastRelayout may change first/last view position.

It's not necessary to invalidate the first/last view position
in every layout pass since most time they are the same.

however, we should invalidate scrollmin/max when the first/last
is not visible yet but current visible items already grow out
of the scrollmin/max range.

Tested on TV and tablet.

TODO: scrollMin/Max on secondary axis.

b/15414917

Change-Id: I125025a5865df69316dadc612b52b67d8f27a250
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
45ef49ba4d3b9bd0a4c9764749b3f9faa6c6abd6 04-Jun-2014 Craig Stout <cstout@google.com> Fix child selection listener dispatch.

b/15425688

Change-Id: I6e3e28074f6a4c163f400b5c9e99068154a3d6f8
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e0a1253fccf626dbc9c0d3aaf03ab903d1485171 04-Jun-2014 Dake Gu <dake@google.com> Merge "GridLayoutManager: avoid redundant dispatchChildSelected" into lmp-preview-dev
0d9c25bab934568d041d93281287f831fdd0c169 03-Jun-2014 Dake Gu <dake@google.com> GridLayoutManager: avoid redundant dispatchChildSelected

If it's fastRelayout, we fire dispatchChildSelected only on mFocusPosition
changes, this can avoid mutliple events fired by view size change animation.
If it's not fastRelayout, it can be a structure change, so we
always dispatchChild regardless mFocusPosition changes or not.

In scrollToView triggered not in layout, there is no structure change
so it will dispatchChildSelected only if mFocusPosiiton changes.

b/14807080

Change-Id: I5ac770181542955360c4d0531d5110694db04b89
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
92a959ab2b3c3c99aabb03cd999ff223763128da 03-Jun-2014 Craig Stout <cstout@google.com> Fix NPE when measuring with wrap_content and no items.

b/15369861

Change-Id: I338e2be5613442900e23ea4e1a590db7cc5f2482
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9de682083d3da5b1127969ee1fd7b74561aa9acd 02-Jun-2014 Craig Stout <cstout@google.com> Fix view recycling.

GridLayoutManager must recycle existing views when rebound.
ItemBridgeAdapter must track view types globally.
Increase the max recycle pool size (defaults to 5).

b/15291691

Change-Id: I861da37f39e1a35d1d7bd38579269b814b736234
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
37390806e43578a40f1275c3c0497eaa83971697 30-May-2014 Dake Gu <dake@google.com> GridLayoutManager: don't fire selection change event in prelayout.

This is not only duplicated, but also might be wrong with index mangled
by RecyclerView in prelayout pass.

b/15343493

Change-Id: I5960f67dd66c6f55814aadcc904b4bf200392a39
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
43329fc348a0134d4a3273796a6a9cf71dad04a5 28-May-2014 Craig Stout <cstout@google.com> Add Recycler and State parameters to LayoutManager.onMeasure.

Allows a layout manager to measure children when measuring itself.

b/14885970

Change-Id: Icad22a5e4d19b9827c4c601a364a83bd84883cd2
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
4200ae975bfd7e4dc2e5c2d838c070470fcb3e2a 29-May-2014 Dake Gu <dake@google.com> GridLayoutManager: supports item animation

Remove all GridLayoutManager animation code and use item animation
in RcyclerView.

TODO: there is a regression that hovercard resize animation is not supported
but we dont have a use case for now.

Fixed a NPE in scrollVerticallyBy

b/15079477
b/15004615

Change-Id: I67245bd0c2f6c3265a3b309b5f47e3f0c10ac6b3
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
6e0cf9c34636f450f1ada4bf3f53a98c7a3fe9df 27-May-2014 Dake Gu <dake@google.com> GridLayoutManager: stop using adapter + smooth scroll support.

Stop using Adapter, use State. State and Recycler references
will be released after onLayoutChildren() and scrollHorizontallyBy()
finishes.

Switch to use SmoothScroller for scrolling to invisible child.

Change-Id: I8d0e1e93dd226328cc337ab26f113c7c52cfc7c5
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
d4a794983364c7b1801638abc7f332abee12b6e6 28-May-2014 Yigit Boyar <yboyar@google.com> RecyclerView Cleanup

Removed deprecated methods from RecyclerView.

(cherry picked from commit 34106bc044343fdac6d16623166d17cda17c083e)

Change-Id: Ie9de0aae4519b870302424deaf2326cbf9e4b7fc
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9c0d20dbcdf7afc18f429ad54a2250f82bd85841 24-May-2014 Tim Kilbourn <tkilbourn@google.com> Override correct scrollBy methods in GridLayoutManager.

Change-Id: I394a9267efd720f2b0de0a68d46914d0aa1c26c3
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e43e9266c4b7e4902fefb5d2a0cacca90a3d2681 16-May-2014 Dake Gu <dake@google.com> Browse: fix the space between rows in not expanded state

when expanded goes to false, half the vertical space to make
it equal to the horizontal space between cards.

remove the hardcoded 16 pixels due to compensating paddingTop
of horizontal grid view. Instead, introduce a flag
"setItemAlignmentOffsetWithPadding" in ItemAlignment.
So row will align the top of horizontal grid view(R.id.row_content)
plus the top padding of horizontal grid view to a fixed position
vertically.

Fixed some bug of handling optical bounds in ItemAlignment.

Removed duplicated browse margin dimens.

Change-Id: Ic3dcad2935bc7e4b525e6f830603bdce46e73086
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
4510b275c55d9a3dae13af38196d3bc6affd3dfc 16-May-2014 Dake Gu <dake@google.com> fix janky "hide title transition"

don't prune the rows during transition, so they can be slided
out instead of faded out at original position.

b/15017332

Change-Id: Icc6e8b7d7c0b1f10ae2372bcb1b644455f1063d2
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
2a0b55c390f4b75b3ae752b8407bf3da9d18a01e 16-May-2014 Dake Gu <dake@google.com> GridLayoutManager: fix layout animation

Just animate between x/y changes in layout, shouldn't animate
scrolloffset change.

b/14594235

Change-Id: I68e5cc9c53eb2e26ad50f09ff7b4064d05f0c203
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
0018dd1964053d44696aee1c564dd0a70b53fc24 09-May-2014 Dake Gu <dake@google.com> fix NPE in Settings app

don't fire child select change when !mLayoutEnabled.

Change-Id: I5fa69e2218a540efa4224d53bc1b0d158567816d
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
2f97594742886d045ca1ce409ebc6e6e780452f6 06-May-2014 Dake Gu <dake@google.com> browse transition

fix bug that ListRowPresenter does not fire row selected event.
adjusted pivotx of header.
add fast lane header sliding transition.
fade row header in-place while moving parent.
Merged transitions into concurrent to make the transition more "tight".

b/14164663

Change-Id: I360118c98950519ed7e9dc3bf67dbe0bfdd45995
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
dc362d4642900b852df2dd63e98848b6621cbe92 08-May-2014 Dake Gu <dake@google.com> fix fast relayout bug

after pushing items down/up, we should update rows min/max before
appending more items.

b/14651901

Change-Id: I5ec05e30746020c5dece90e7c67220f80eb63aee
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
57070ccd71477252474e3c4d35edddbc859c6179 05-May-2014 Craig Stout <cstout@google.com> Merge "Support for bidirectional view layout along primary dimension."
aaeddd3d703a597945778a749fbef2d85532802d 18-Apr-2014 Craig Stout <cstout@google.com> Support for bidirectional view layout along primary dimension.

Layout direction is determined by whether the view was appended or
prepended.

Change-Id: I63aef2f7c7fbb93db9975d210a6f212c0b72ffcd
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e34cae48707e70442aca13e1b4ab55757292828d 02-May-2014 Dake Gu <dake@google.com> VerticalGridFragment title transition

Change-Id: I4f2d17ffe112e5ea89e5392a519d90e236e1e48d
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
f272f7533fcb5aba341e9ab2f4ff0421d668a8ca 26-Apr-2014 Craig Stout <cstout@google.com> Support for wrap content on the secondary axis.

Change-Id: I96ca955025c2d5b1857bd29febbcf2d0ac7e825a
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
101dde19d1d2150afb02d1bf1d78a1759265c928 30-Apr-2014 Dake Gu <dake@google.com> Merge "Support header changeBounds transtion between fastlane and row" into klp-modular-dev
2d8ec4a44f2ffcfb83247c5f0e12e45aec7e4174 29-Apr-2014 Dake Gu <dake@google.com> GridLayoutManager: new method signature

Change-Id: I6a1a698eb59c973bd48cbd986805da01773c38d2
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
3c23ada8bc25a05bbaa8c479a9df72e8172c4349 18-Apr-2014 Dake Gu <dake@google.com> Support header changeBounds transtion between fastlane and row

Now both fastlane and text view above row share the
same RowHeaderPresenter by default, this allows
customized RowHeaderPresenter also being used in fast
lane. Transition handles the transition between
them.

No longer detach/attach fast lane, goes back to the
original hide/show mechanism, also split the transition
work from focusSearch() and performed after focus changed.

Added a Customized changeBounds transtion that support setting
staggered startDelay of fastlane text views.

Change-Id: I688074b850c088c2ff53039d235ba70f88c38da5
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
26bfc3c42a1e0b0bd08bf2bb1142b371b60aa7d3 05-Apr-2014 Craig Stout <cstout@google.com> Fix adapter update during measure.

Change-Id: Ia42463cdc0f5054c4771a439c6f310dcfaee2ec1
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
9240e796bc63422c28f2707840bd99c48573279b 14-Apr-2014 Dake Gu <dake@google.com> more transition support and fading edge support

Use fading edge effect instead of switching clipToPadding, this also
fixes bug of shadow gets clipped by padding.

Let TransitionManager control the browse rows animation, disable
grid view animation during transition, grid view should
re-initialize the start position values when layout animation is
turned on after transition completes.

Made transition customizable from code, adding listeners.

Change-Id: I7904a3731f58af035e207cf61ad7ab174cee231a
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
31aa83dc228c115ff48105dd36f25304dd744460 14-Apr-2014 Dake Gu <dake@google.com> Revert "GridLayoutManager: fix bug if current focus is on top of grid view"

This reverts commit bcb7bf9b051050fa44ae270b4ac0ecab5456fe33.

That change caused issue that press DOWN in last item of fast lane will focus
to right side by default focusfinder. We have to revert this issue. To focus
on widget overlaid on top of RowsFragment, user has to override focusSearch()
in a customized widget like BrowseFragment does.

Change-Id: I360df90a3b8d05bba8548c0e0a0bfd58d59988a6
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
bcb7bf9b051050fa44ae270b4ac0ecab5456fe33 10-Apr-2014 Dake Gu <dake@google.com> GridLayoutManager: fix bug if current focus is on top of grid view

When focused search widget is on top of grid view and inside padding area,
FocusFinder gives gridview a negative score since its top edge
is above top edge of search widget. So nothing happens when
click DOWN from search widget.

BrowseFragment does not have the problem since it has a customized view
overrides focusSearch(), but for user who is using RowsFragment directly, we
should make the default focus search working.

Change-Id: I916d9666076cb977296617075dc0721857d9a04e
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
43040065f16c57e180957a2afc27ecc706977491 05-Apr-2014 Dake Gu <dake@google.com> GridLayoutManager: fix crash of adding then removing end item

incorrectly append items which is in staggeredgrid history
but deleted by adapter.

Change-Id: I5028ba3a04e97a0cdfcf00e140a5abd741f6eb10
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5fb3146be35c38a8fb794c2b8566e35e6c049401 03-Apr-2014 Dake Gu <dake@google.com> Merge "fix undesired horizontal scroll when focus from fastlane to row." into klp-modular-dev
9421aa6ca7de4174ddbe2e10fbb05cb31685ffcc 02-Apr-2014 Dake Gu <dake@google.com> fix undesired horizontal scroll when focus from fastlane to row.

We have code in addFocusables() to avoid focus to views
in padding area. But when we switch from fast lane to
row, addFocusables() is not called, instead hroziontalGridView.requestFocus()
is called, which will by default find the first item in horizontalgridview.
Overrides onRequestFocusInDescendant() so that we only returns items
not overlapping with padding area.

enforce "focus after descendant".

Renamed some internal methods to avoid possible conflicts
if recyclerview add methods later.

Change-Id: I24fd175d7fe48924793f2b12fc8ea146280dcb3b
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e560a9d4e4a73def79923a15ae22109746fa9cbd 03-Apr-2014 Dake Gu <dake@google.com> clean up optical insets

abs() gets wrong optical bounds value for negative diff values.

Change-Id: Iecf4870d115eb5b6f7b00877a8ab477111207719
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
7016761eb6734c4070f6177600acfb52bf021b7c 03-Apr-2014 Craig Stout <cstout@google.com> Fix optical bounds issue.

Change-Id: I2b99264a23641fc6de7c36c5f7fb03f0e800b6c3
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
a5debe12465cc730b394651bed2acf894c60b65b 02-Apr-2014 Craig Stout <cstout@google.com> Revert "fix undesired horizontal scroll when focus from fastlane to row."

This reverts commit 5b1f117209e8a38d6d6b004c3c0d0285acc9b27f.
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5b1f117209e8a38d6d6b004c3c0d0285acc9b27f 02-Apr-2014 Dake Gu <dake@google.com> fix undesired horizontal scroll when focus from fastlane to row.

We have code in addFocusables() to avoid focus to views
in padding area. But when we switch from fast lane to
row, addFocusables() is not called, instead hroziontalGridView.requestFocus()
is called, which will by default find the first item in horizontalgridview.
Overrides onRequestFocus() so that we only returns items
not overlapping with padding area.

remove the descendant focusability code since gridmanager should be always
focusing after descendant.

Renamed some internal methods to avoid possible conflicts
if recyclerview add methods later.

Change-Id: Iefd24a7f2a09341daeebe94736cfd4a5c62cd530
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
adc2a01f5701cbcc044754119b572abcf31c7c5f 26-Mar-2014 Dake Gu <dake@google.com> GridLayoutManager: support paged focus scrolling

- FOCUS_SCROLL_ALIGNED this is what we currently have:
keep focused aligned.
- FOCUS_SCROLL_PAGE scroll page by page
- FOCUS_SCROLL_ITEM scroll item by item

Changed default BrowseRowView horizontal scrolling to use
FOCUS_SCROLL_PAGE.

Change-Id: Idc4cc2e7d4833cf9b24c8c9505b03e945667af59
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
ce08db4f13dd7f7a82694b440462d7484cfb7c5b 01-Apr-2014 Dake Gu <dake@google.com> Merge "draw focused item at last" into klp-modular-dev
182f3350d5f3cef04d160c673b6969df28e9439c 01-Apr-2014 Dake Gu <dake@google.com> draw focused item at last

b/13734333

Change-Id: Ib907699aa84be726fdce9076e41ccfb091627767
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
5a2782ae17df5331a594fe03d5d89251a8b9f6d4 29-Mar-2014 Dake Gu <dake@google.com> GridLayoutManager: support gravity in secondary direction

allow child view to have a different size in second axis
other than mItemLengthSecondary. Depending on the gravity,
align the child view on secondary direction.

Change-Id: If02dd8c069219bf28791770dc3643956645ed634
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
c26ebee190513b93c6f30620dac3bfc9038cb621 21-Mar-2014 Dake Gu <dake@google.com> GridLayoutManager: subclass LayoutParams instead of using Tag

Also make it ready for future customized layout params.

Change-Id: Ic72f03d433c84ba0871117a189b4e2482a3bf69f
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
e14d72261ac77c75ee77bdeb4557b57f87feb242 24-Mar-2014 Dake Gu <dake@google.com> Merge "GridLayoutManager: Fix missing margin" into klp-modular-dev
a8a3b898da49324e83ea32c3f08776a481312166 21-Mar-2014 Tim Kilbourn <tkilbourn@google.com> Rename some leanback lib classes.

RowHeaderFragment -> HeadersFragment
RowContainerFragment -> RowsFragment
BaseListView -> BaseGridView
ListView -> VerticalGridView

Change-Id: Id37cb80a95122247aa33c55e545ece9f526df073
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
fa9a61fa061befbbbd49b01ec926a0fe8d61a9a5 21-Mar-2014 Dake Gu <dake@google.com> GridLayoutManager: Fix missing margin

when we layout focus item in first row then layout prev item
in second row, the second row does not have any item yet, we
forget to add margin in this case.

b/13571410

Change-Id: Ied16bc560f55043e063f9d6554e7c4c6749d377d
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
c1f3bcf2f1deac4603cddfb9548380ba20a5f310 19-Mar-2014 Dake Gu <dake@google.com> GridLayoutManager: fix ArrayIndexOutOfBoundException in onAddFocusables()

Fix the bug when child focusable is false.
b/13547532

Change-Id: I7ec0fce47b04775c2f90853d952783a773b31c62
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
b56bf9a6ae8a8490ff440ed8c136a72ee6398157 18-Mar-2014 Dake Gu <dake@google.com> RecyclerView: minor change of onAddFocusables() signagure

Pass RecyclerView as parameter.
Uses ArrayList instead of List to match View.addFocusables().

Change-Id: Iac06f2e862894ee9c420cfab062289500baf9067
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java
8b068ddbbf22a246eab49ec25a2f7c3abfbdca51 16-Mar-2014 Tim Kilbourn <tkilbourn@google.com> Add a .readme file to be copied into the sdk src.

This allows the project resources to be built by ant/eclipse.
Also moved default source code dir to src instead of java/src.

Change-Id: I9e5002fbbfb96b98be772c1ec6653322d5563b56
/frameworks/support/v17/leanback/src/android/support/v17/leanback/widget/GridLayoutManager.java