History log of /frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
Revision Date Author Comments (<<< Hide modified files) (Show modified files >>>)
9eeb624e8d3a9e7dc4e70eec759ab60104aab459 07-Mar-2017 Dake Gu <dake@google.com> RecyclerView: fix UPDATE wrong cached view when moved

Recycler.viewRangeUpdate() should use mPosition instead
of getLayutPosition(), in the same way
RecyclerView.viewRangeUpdate()

Bug: 34672504
Test: RecyclerViewLayoutTest.moveAndUpdateCachedViews
Change-Id: Id3bc9c99ecde2a62968951dc617bf2efb64fe25f
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.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/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.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/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.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/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
65dea0f8960efe2487c05abeeccb92689bab1332 19-Oct-2016 Keyvan Amiri <keyvana@google.com> Added focus recovery mechanism to RecyclerView

Fixed RV's focus issue in two cases: If RV received focus before or
during layout, the focus was not passed down to the children. The seocnd
case was when RV's prior focused child became unfocusable and animation
was disabled, RV didn't redeliver the focus to a child after layout is
complete.
Also, made a best-effort redelivery of focus to a child when the
previously focused item is no longer valid.
Added several tests for reproducing the bugs and verifying focus
recovery logic across different adapter change scenarios as well as adding
animation parameter for tests.

Fixes: 32280153
Fixes: 32486474
Fixes: 32227010
Test: ./gradlew support-recyclerview-v7:connectedCheck
-Pandroid.testInstrumentationRunnerArguments.class=android.support.v7.widget.RecyclerViewFocusRecoveryTest

Change-Id: Ibaff9ee6699efe4a6800faf0f34c701a24baafdc
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
42e7d6fafcde7bfe261dd7d8d75ee53ca0cd6790 28-Sep-2016 Aurimas Liutikas <aurimas@google.com> Replace usage of Instrumentation#runOnMainSync with ActivityTestRule#runOnUiThread.

ActivityTestRule#runOnUiThread handles exceptions correctly and thus should be used
in place of Instrumentation#runOnMainSync. This changes most of these use-cases
except for tricky cases.

Bug: 31801302
Test: ran support-design:connectedCheck and support-appcompat:connectedCheck
Change-Id: I70904aef89e6bbc2a3cff1b3be697258d666e316
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
3911e1c2d38e301d5ffbdf11f808fdc593dd83e9 09-Sep-2016 Aga Madurska <amad@google.com> Add tests for edge view to the LinearLayoutManagerSnappingTest

Also, stabilize the Linear- and GridLayoutManagerSnappingTest
as they seemed to have a flaky setup.

Bug:31399980

Change-Id:If7780a5cc863a53cf4df946d186dfd5ae28274cc
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
e54c4f143c6bca9e3fc7184119ca40f2742804ff 18-Aug-2016 Yigit Boyar <yboyar@google.com> Remove main thread assertion from test

Bug: 30229849
Change-Id: I09d25bebf28f45423320e79d1ba2ad49a327bdb0
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
178c4e15a0ebb501d2bb4f3ac3176e4c44954954 09-Aug-2016 Yigit Boyar <yboyar@google.com> Invalidate decor offsets after rebound

RV invalidates decor offsets eagerly which creates a problem
if predictive animations are enabled. In that case, we will
be updating decor offsets before updating the item and
will not update after updating the item.

This CL changes the behavior such that we will use dirty
offsets in pre-layout if item is not re-bound yet and
will invalidate the decor offsets when it is bound which
will trigger a call to the item decoration to update the
offsets.

Bug: 29989333
Change-Id: Idc23f83be19164cf137fa81242e6c90c4e85fbae
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
9290baf2c13c27d6f6d517b198a3fc079b83f297 09-Aug-2016 Yigit Boyar <yboyar@google.com> Override package private methods to make them public for tests

Mockito Proxy class does not work well with package private methods
on Kitkat (and probably below). This CL makes some package private
methods public so that
RecyclerViewLayoutTest#requestRectOnScreenWithScrollOffset
can pass. We probably need more of these.

Bug: 30762016
Change-Id: I19abdecb07983e3db20bd85f697c34b5df34062d
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
9f5e74d12c89334c2bd439b1bf19fdc5ebfbc137 05-Aug-2016 Aurimas Liutikas <aurimas@google.com> Attempt to reduce RecyclerView test flakiness.

Locally it seemed to have fixed the failing
StaggeredGridLayoutManagerSnappingTest

Bug: 30577506
Change-Id: Icb3d18f47a5986cfaef551ca2593ae26a96447d6
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
c587f7dba5a337169e854e235da59f595255d6cc 20-Jun-2016 Aga Madurska <amad@google.com> Add an OnFlingListener to the RecyclerView.

This enable custom fling implementations and
is used to implement expose a snapping API
to developers.

Bug: 28169210
Change-Id: I09ffcab384eb69338df1fcc5f8d1d2a0d1191a57
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
d8d42d52f8ae53107ffa849b86496650182e24b8 13-Apr-2016 Yigit Boyar <yboyar@google.com> RecyclerView focus search improvements

This CL fixes a couple of bugs in RecyclerView's focus search
handling.
* Built in layout managers were handling focus FWD/BCK wrong if
the layout is RTL.

* RecyclerView was not letting the focus leave RecyclerView if
focus FWD/BCK is called and RV does not have more children in
that direction. It was going back to the top of the list instead
of letting the view system give focus to the next view outside RV.

* RecyclerView was losing focus when focus FWD/BCK is called and
RecyclerView has more children to layout but they are not laid
out. In this case, focus was escaping the RecyclerView because
it was not laying out new children in the focus direction because
it already has some valid candidates. In this case, RecyclerView's
candidates would be overridden by other views outside the
RecyclerView.

Bug: 27222294
Change-Id: Ia5583c21df0a354d53c013aa76c4f9b475240c1f
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
a90fb62f06861beb3af9f9b3356ef0bb0685547c 12-Apr-2016 Yigit Boyar <yboyar@google.com> Don't invalidate layout on detach

This CL fixes a bug in RV where it was always expecting an onLayout
call after it is detached which may not be the case if the RV's
parent is detached-attached.

With this change, RecyclerView will only clear firstLayout flag if
a layout is already requested.

I've also changed SGLM to request layout on onDetach since it
releases View references.

Bug: 27229764
Change-Id: I8d7b2c9bc2b3e24eaa66253153ffa0c960f81bc6
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
66826566020afc8d11f183cf3fe443ac0a022384 05-Apr-2016 Yigit Boyar <yboyar@google.com> Test stability improvements

* Fix wait for layout's idle wait to ensure RV's layout is complete
* Made main thread exception private to have more strict control
around its usage

Change-Id: I40d414538c16459400fe6460a638848de9ee5597
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
251c29b47e062b1093aa2f8fbb61ab080511c38f 06-Apr-2016 Yigit Boyar <yboyar@google.com> Merge "Consume pending should bring layout to clean state" into nyc-dev
e3b89d11cf08a0e9aaa8162757246f286c6df2f8 29-Mar-2016 Yigit Boyar <yboyar@google.com> Preserve focus after layout

LayoutManagers try to keep focused view visible during a layout
calculation. This does not work well if the View is being replaced
with another view due to type change and/or animation. It is
beyond LayoutManager's intended control to care for this case so
RecyclerView will track it and recover focus to the new View
if necessary.

Bug: 25510761
Change-Id: I65680577587839ecfe84a931998da8b9926b5566
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
7f5e94985f795f81884334ca2752a0469a998762 01-Apr-2016 Yigit Boyar <yboyar@google.com> Consume pending should bring layout to clean state

Previously, consumePendingUpdateOperations would not run a layout calculation
if the first layout has not happened yet. This was inherited from old logic
where RV runs its own layout pass and if the view hierarchy will run a layout
pass, we rather skip it.

This was not the correct behavior for some use cases where we may receive a
scroll / fling etc callback while mFirstLayoutComplete is false (e.g. RV
has just been attached).

Since RV's custom layout request already checks for first layout flag and
this method is heavily used to sync state of the layout, I'm changing it
to RUN a layout if first layout has not happened and we need to sync
state to be able to call incremental methods.

Bug: 27926253
Change-Id: I3ba5b705713782de6140d4a1da6ef4fc05e94f5c
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
959f4c0fac89425a8a9842e82fc180ec736fffac 11-Mar-2016 Yigit Boyar <yboyar@google.com> Make RecyclerView tests faster and less flaky

This CL makes a bunch improvements in RecyclerView tests.
* Change requestFocus helper to wait for smooth scroller (flakiness)
* Disable activity launch animation (perf)
* Make sure SavedState tests uses same items on restore (flakiness)
* Better step calculation in TouchUtils (perf)
* Replace scroller to add a listener instead of busy waits (perf & flakiness)
* Re-use the same TestActivity between tests. (perf)
* This seems very dangerious but given that we have many short running
tests, it greatly improves the performance.

Change-Id: Id17e5b581c690816e82726bcabfd4899d13b6403
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
3d37afbbf7bf547c1e1c541df9be9696da668884 26-Jan-2016 Yigit Boyar <yboyar@google.com> Check child's scrollX/Y on bringChildRect method

Bug: 25787435
Change-Id: I21c73470a97db0db15f415442425eae71c5c6a34
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
4143554adb9b31b700b6876a251a64419e6111e2 10-Dec-2015 Yigit Boyar <yboyar@google.com> RecyclerView Automatic WRAP_CONTENT support

This CL adds support for wrapping content for RecyclerView while
supporting predictive animations.

It is an opt-in API which is off by default because these changes
will change the callback flow, especially will start calling
LayoutManager#onLayout when RecyclerView#onMeasure is called.

See LayoutManager#setAutoMeasureEnabled for API details.

All built in LayoutManagers support WRAP_CONTENT using this new
mechanishm.

Bug: 22508392

Change-Id: I6e010f8807e9d2fa379dd52493b2d8340b8c65de
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
0a017072206f93474ccd2706e7983c2ff778b904 07-Jan-2016 Yigit Boyar <yboyar@google.com> Move all RecyclerView tests to Junit4

This CL moves all RecyclerView tests to Junit4 and uses
the new ActivityTestRule instead of ActivityInstrumentationTest.

Bug: 24494874
Change-Id: I049d8b1ac7869a6af13a3ee7905d6dd1f6eb418b
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
f89e1b82c74b7b85df3a349340a643f62fc5bfa1 29-Dec-2015 Yigit Boyar <yboyar@google.com> Focus search improvements

This CL fixes a bug in GridLayoutManager where it would choose
the wrong view when it scrolls for focus search. Not it does
it properly by prioritizing currently focused View's span.

This CL also adds focus search failure support to StaggeredGridLM.

Bug: 26338413
Bug: 26333507
Change-Id: I263508be1b987f8630a65267cb17efba600292e3
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
4bcf88a56f3048a7ead6f423faa8fa08b95c5dae 01-Dec-2015 Yigit Boyar <yboyar@google.com> Always consume pending updates before post layout.

This CL fixes a bug where RecyclerView would decide not to
run predictive animations due to some other criteria besides
adapter updates.

Now we always process adapter updates before running post layout.

Bug: 25948838
Change-Id: I83d65c9afc0551fc02ede087dcf338f71f0cbb6e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
9051a368c00c40f8679ae67147b9f5af6f93638d 17-Sep-2015 Yigit Boyar <yboyar@google.com> Reuse hidden views if asked for

If a LayoutManager tries to get a view that is in the
hidden list, Recycler used to recycle it so that it
can be safely rebound as a new item.

This approach, although safe, creates UI glitches
as item jumps from a location to another instantly.
To overcome this issue, now Recycler unhides such
views and moves them to scrap. It also reports it
to the item animator with necessary flags so that
its appearance can properly be evaluated as a
persistence (or change).

Bug: 24176126

Change-Id: I9858abdd6faf859bdc2ee2a9d2a88228c21fa9b1
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
121ba9616e5bed44d2490f1744f7b6a9d3e79866 30-Aug-2015 Yigit Boyar <yboyar@google.com> RecyclerView Animation API V2

This CL introduces a new Animation for RecyclerView that
gives more responsibility and power to the ItemAnimator.

It is backward incompatible but there is a new SimpleItemAnimator
that mimics the old API for easy transition.

The main goal for this API change is to enable better change
animations. This change will enable ItemAnimator to easily animate
contents of ViewHolders.

Bug: 22507896
Change-Id: I4d9a6b92ff5c27691b277a777da77116476b1cd3
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
ef3e37fe088c7d8e614bbc4ed58d6c0d3fa807a1 29-Jun-2015 Dake Gu <dake@google.com> RecyclerView: add setLayoutFrozen(boolean)

Add a method to stop recyclerview from udating children.
Including:
- delay the adapter change.
- stop scroll and inner scroll
- stop scroll animation
- cancel ItemTouch helper (dragging)

b/22067316

Change-Id: I24e7baf3477022025a2bba8e56343c5af7196403
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
c9d554f5655a85f1b446c988ff94d32e54557899 10-Jun-2015 Vladislav Kaznacheev <kaznacheev@google.com> Merge "Delay restoring RecyclerView layout state until adapter is non-empty" into lmp-mr1-ub-dev
3d8453880afb3e32c4c59c52b8b580f91d78b29f 20-May-2015 Vladislav Kaznacheev <kaznacheev@google.com> Delay restoring RecyclerView layout state until adapter is non-empty

Bug:16901000
Change-Id: I28c9252f7b9f0c782496a2c8ea77a6eb791ab0d4
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
5321949b1ca4113d9ebd5ca488a27f17224118a1 09-Jun-2015 Yigit Boyar <yboyar@google.com> Merge "Make SGLM view snap test less flaks" into lmp-mr1-ub-dev
29c349ed8863cc15c2580465227c37771ac49576 09-Jun-2015 Yigit Boyar <yboyar@google.com> Make SGLM view snap test less flaks

This CL fixes a bug in SGLM view snapping test where it
may fail if device's size is not a multiple of span size.

Change-Id: I8c7e4d35018921afcc7bd2b6f7d0493dbfb98b92
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
5a9366fba5e26329bc9a988cfd2d43df980f2764 09-Jun-2015 Yigit Boyar <yboyar@google.com> Prioritize delete animation over move animation

RecyclerView was running a move animation when an item
is deleted but also moved. We should run delete animation
instead to make sure proper callbacks arrive.

In the future, this can be changed but for now, it is not
LayoutManager's responsibility to move a deleted item so
occurrences of a "deleted item being moved" can be ignored.

Bug: 21639668
Change-Id: I5b1cfa37a7e5e7a2ef34d7cc76fbebc41907cf9a
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
629687bba8da1a73c48d8fe87393a13581ce46ca 05-May-2015 Yigit Boyar <yboyar@google.com> Improve some tests

This CL fixes some tests that are failing in the emulator

Bug: 20857006
Change-Id: I8f669678403e33d16af3e2de29851d6fcc7cab13
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
f129f1b050d2542a91fe8175eac30183beb07b41 20-Apr-2015 Chris Banes <chrisbanes@google.com> Nested Scrolling support for RecyclerView

Also fixed annotation for ViewCompat's overscroll

BUG: 20334660

Change-Id: Iafa2f52f63d9aa9d5c8ce10b5e8bf108c1407a12
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
e05fbd9cfe05496e82a3abe19e07e8745985e9a5 27-Apr-2015 Yigit Boyar <yboyar@google.com> Fix SGLM child position bug

Looks like SGLM had a bug where it would put children with gaps
when filling above and below anchor line. This would mostly happen
if clip to padding is false because it was not properly handling
clip to padding.

This CL changes how SGLM handles recycling in a long with fill state
preparetion. This also makes it 100% compatible with clip to padding
false.

Bug: 20565830
Change-Id: Iae9a5bd50865e552120f85c8f511986c8e9f4395
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
e71a1df9b3c0e1bd3c21a1b3dd20a41790d4a950 06-Jan-2015 Yigit Boyar <yboyar@google.com> Item touch interactions helper class

Notice: TBR, APIs may change

This CL adds a component that can attach to any RecyclerView
and add support for Drag & Drop and Swiping.

It assumes some defaults based on the scroll orientation of
the LayoutManager but can also be extended to customize behavior.

Bug: 18889496
Change-Id: I7aede2084efa599552e053596661fa58b2685d10
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
888093b0a071a99d65c01116cf703d46b21f9918 14-Apr-2015 Yigit Boyar <yboyar@google.com> Fix layout state setup for predictive layouts

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

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

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

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

Bug: 20158083
Change-Id: Iefd4775161485185fc6255a20cddc3bddfd04134
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
2bf89a9bae2b6110a77cf0b3754b567bb07d12a5 09-Apr-2015 Yigit Boyar <yboyar@google.com> Postpone accessibility events to post layout

During a layout calculation, some accessibility events
might be triggered by the view system synchronously.
These events are very hard to handle for a LayoutManager
since it is in the middle of calculating a layout but
received an accessibility request while trying to
obtain / add or remove a View.

Instead, RecyclerView will silently block these calls
until the end of the layout or scroll calculation and
then dispatch content change to avoid these race
conditions.

This CL also backports more Accessibility code to support
library.

Bug: 19717689
Change-Id: I98aac9264579714352554a7e9cbd2f712a72e6ee
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
ec60a348ce39889a99f7ca02da94a6867bfdf66f 13-Feb-2015 Yigit Boyar <yboyar@google.com> StaggeredGridLayoutManager gap handling bug fixes

SGLM may fail to detect a gap if it is created for not having
enough items while filling towards HEAD. Although it could be
fixed by detecting the case and setting a flag, running a
full gap check at the end of a post layout seems more stable.

Bug: 18970779
Change-Id: Ie267092335ce74d315b4677af78c3adf3a98af61
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
da50fde358bd3ef2edb273b3bf0265cf5e84ec6b 12-Mar-2015 Yigit Boyar <yboyar@google.com> Ignore accessibility events if layout is invalid

This CL adds a check to AccessibilityDelegate to ignore accessibility info
requests if RecyclerView has a pending layout calculation. These callbacks
are problematic to handle in these limbo states because any custom callback
does not necessarily know whether RecyclerView could update or not.
Also, since there will be a layout calculation in near future, all these
events will arrive again.

This CL also adds a public API to query this state so that developers can
take advantage of it for custom logic (e.g. ignore click event if data is
invalid).

Bug: 19085424
Bug: 19717689
Change-Id: Ice13ed8d77657632007686bc57183f09954b8e8a
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
dcc9af3f0c93d51cd8d0c694f1c0cdcd2d7ae405 03-Feb-2015 Yigit Boyar <yboyar@google.com> Merge "Update ChildHelper data before calling ViewGroup methods" into lmp-mr1-ub-dev
619ac016831a5ad75c2e0921c9036b6f030a9e63 29-Jan-2015 Yigit Boyar <yboyar@google.com> Widen the scope of ViewHolder#getAdapterPosition

getAdapterPosition in ViewHolder needs to access RecyclerView to get
the up to date position. This does not work if developer wants to
access adapter position in onViewDetached/Recycled callbacks.

This CL adds a reference from ViewHolder to the RecyclerView for the
duration it is controlled by the RecyclerView (right before binding
from the adapter till it is passed to the RecycledViewPool).

Bug: 18960075
Change-Id: I4e310aff14f827f6289caaf2b94e61288ed3fb1a
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
de5f54783555fa2e778c4ed6760472a002b2589b 21-Jan-2015 Yigit Boyar <yboyar@google.com> Update ChildHelper data before calling ViewGroup methods

ChildHelper used to change its internal data structure after calling ViewGroup.
Although this worked well for most of the time, (because we don't have any other
operation in between), it may create a problem if we receive a callback
from the ViewGroup while the item is being removed / added. In that case,
since the add/remove call did not return from ViewGroup, ChildHelper's
data will NOT match the ViewGroup's data.

This CL changes it to make sure ChildHelper updates its own data structure
before calling ViewGroup.

Bug: 18841490
Change-Id: Ia3cceb60cc207f2020c8c695b4acde7a41010b75
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
542f1260934df280985294eaef1ec8469863281f 09-Dec-2014 Yigit Boyar <yboyar@google.com> Better preserve focus on RecyclerView resize

Bug: 17980781
Change-Id: Ibccdcb3b6b4d98777996bf6e9e652ef3765486c8
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
e37d2e63f16bc5c2938e372238ba54679a9e578e 27-Nov-2014 Yigit Boyar <yboyar@google.com> Enable getAdapterPosition when View is rebound

getAdapterPosition used to return NO_POSITION if data set has changed
after the last layout and the next layout is not complete yet.
This would be a problem if RecyclerView already processed adapter
updates, rebound the view but has not finished the layout calculation.

This CL starts tracking position invalidation per ViewHolder and
removes the flag as soon as it is rebound. This way, when
ItemDecoration callbacks are called, developers can access adapter
position.

This CL also adds a test to ensure that ItemDecoration callback
promise is kept so that we don't break it in the future by mistake.

Bug: 18524432
Change-Id: I3fc7ac9b0d78bd87b1b85ed15c99af89e252c58b
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
115ba0c7b2a14aa4cd0273952195e1d8f6468f87 10-Nov-2014 Yigit Boyar <yboyar@google.com> Deprecate ViewHolder#getPosition

getPosition methods in RecyclerView were ambiguous because of the deferred
handling of adapter updates. To avoid future confusion, this CL deprecates
methods that receive or return "position" and introduces two methods that
receive / return "layoutPosition" or "adapterPosition".

This will help developers get the exact number they need (e.g. the position
in adapter vs the position user is currently seeing)

The following methods have been deprecated:

RecyclerView#getChildPosition
RecyclerView#findViewHolderForPosition
ViewHolder#getPosition
LayoutParams#getViewPosition

Bug: 18213371
Change-Id: I52667bd43e32fc55de8861f5fdc01a0aa7fbe60f
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
d17ce72488bb0b13b34a3684c86e48c230b6a5a4 21-Nov-2014 Yigit Boyar <yboyar@google.com> Merge "Add an API to let Adapter recycle transient views" into lmp-mr1-dev
e2437126f0225135891544315ff72e54c7de0f59 05-Nov-2014 Yigit Boyar <yboyar@google.com> Add an API to let Adapter recycle transient views

Bug: 17783452
Change-Id: I70f2386b6f7d88e78a389a7fc1f583d0f1c45c0e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
abd0fbfcdd5b438909f126392eca5978b5939b6d 19-Nov-2014 Yigit Boyar <yboyar@google.com> Guard layout managers calls not to crash

Previously, RecyclerView would crash if a call should be handled by Layout Manager
and it is not set yet. Although this makes sense, there are some cases where
developer would like to set LayoutManager after checking some other logic or
RecyclerView is attached/detached w/o being setup. This CL guards a bunch of
public calls to print an error if LayoutManager is not present, instead of crashing.

Bug: 18444564
Change-Id: I666ea346a615ca5338af32b25774bf90bbcb551c
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
90ca3086dbf66ad6bb8840e46ec8524a705e1c18 03-Oct-2014 Yigit Boyar <yboyar@google.com> Fix RV's onViewAttached/detached callbacks

This change also fixes a bug in DefaultItemAnimator.

Bug: 17599182
Bug: 17881182
Change-Id: I4adadeb5d2d7d5aaef0f253eac52d2624de73d5e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
824a7db96feacf3b68f56993ed72712bc935153e 14-Oct-2014 Yigit Boyar <yboyar@google.com> RecyclerView should call correct adapter on swap

Bug: 17687329
Change-Id: I35bc785e6c64d1fd0844286766e8ddb59d061737
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
ca9ce7ccdccf6b6a2a81da73dd1e6425d90e4b23 30-Sep-2014 Yigit Boyar <yboyar@google.com> Assign View spans before they are measured

Bug: 17706218
Change-Id: I349b9a1918825ff6c45079f7617cf499c90c3cd1
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
bb6ebab3b3b85ec20b3bc262289a2460705322f5 25-Sep-2014 Yigit Boyar <yboyar@google.com> Set scroll state when stop scroll is called

Bug: 17644072

Change-Id: Iac0b0cff4ee06b461cebb6e933a5a712a06a7a4e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
572bf0c80bb3db98ce0fbb091073dabc4f1f8af0 15-Aug-2014 Yigit Boyar <yboyar@google.com> Merge "Bugfixes for StaggeredGridLayoutManager" into lmp-dev
c50c4cad31d73e574b27bb3d7581542975e37263 15-Aug-2014 Yigit Boyar <yboyar@google.com> Fixed LinearLayoutManger's scrollToPositionWithOffset

Previously, LLM was not handling scroll to position with offset when layout
is reverse or stack from end, this change fixes it, adds tests.

I also improved how predictive animations are handled. If a visible item is
scrolled, now LLM lays out more children in the opposite direction in pre-layout
so that when they become visible, they don't just fade in but animate from the
correct direction.

Bug:17015719
Change-Id: I2748c0636927159201202a7eb4caf338d67d6ca9
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
d7e2f2ab1d253133fa54f309e74a7ee384c33971 08-Aug-2014 Yigit Boyar <yboyar@google.com> Bugfixes for StaggeredGridLayoutManager

Bug: 16678349
Bug: 16403163
Bug: 16734653

Change-Id: If78aa7ec4a09860ccca698bcb851dff5e5db5ae7
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
f485be9def4c0f72cfdfa6b0c616c23f04652817 13-Aug-2014 Yigit Boyar <yboyar@google.com> Ignored views should be ignored by getViewForPosition

Bug: 16950247
Change-Id: I3940ce3b049a3ae718706c503b0404f3fda43ffd
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
310e95e1c6dfe4f26ef594233e65e1ff83e0f1ff 01-Aug-2014 Yigit Boyar <yboyar@google.com> Improve LinearLayoutManager's re-layout handling

This CL fixes a bug in LinearLayoutManager where it was not respecting
stackFromEnd/reverseLayout parameter when RecyclerView is resized.

With this CL, LLM also considers focused child when selecting the anchor
item so that focused child stays at the same position.

I also cleaned up some code and moved complex stuff to separate methods.
This should help make the code more readable.

Change-Id: I8427ee60ee45c337e7e670853d4eeb002592048e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
6e83751247c5be0211d7bffaf057431c03dfef38 25-Jul-2014 Yigit Boyar <yboyar@google.com> LayoutManagers should not jump to position in pre-layout

Bug: 16550277
Change-Id: I60335e4994309e53311e95c890a4934edead70f0
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
0b1059b711009601ff08354e2df6bfc45266e80a 21-Jul-2014 Yigit Boyar <yboyar@google.com> Add swapAdapter method to RecyclerView

Bug: 16315373
Change-Id: Ia790aff458d2ca61ec403dd9887d9758eb74f47a
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
504c54ea52c1b2aae6f8f4ae128f1dcaac7e3f6a 13-Jul-2014 Yigit Boyar <yboyar@google.com> Support animations during multiple layout calls

This CL also fixes two bugs related to view recycling
* we were moving views to cached view list w/o checking if they are recycleable or not
* AdapterHelper had a bug where it was checking missing views via < -1 instead of == -1

Change-Id: I7d70c1b884c3af046ba78924c9a966f83cda99f0
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
cadd54707a7aaa4cfa9c8b8051c6185e8717f22e 11-Jul-2014 Chet Haase <chet@google.com> Invalidate ItemDecorators more aggressively

This CL also changes the ViewDecorator API to receive View and State instead of position

Bug: 15699227
Change-Id: Ie4deb49eed803540a3bd274454d2e67d2f34a50d
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
8da5bba529a2fe9bd2aafab28010e11ec4de93c7 08-Jul-2014 Yigit Boyar <yboyar@google.com> Reset ViewHolder when it is passed to/from RecyclerPool

* Fixed a code path where cached views may be sent to recycler
even if they are not recyclable. Did some cleanup on how
cached views are handled.

* This CL also fixes a small NPE when we scrap a view holder

Change-Id: I172fbedf0d3ba06b4121fa275d8fa62c583b91b5
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
c8b0ff5869e17a656a3a1d7fb306efa5b99fa07f 07-Jul-2014 Yigit Boyar <yboyar@google.com> Improved how RecyclerView handles stable ids

RecyclerView can re-use views via stable ids but it was going into an
inconsistent state if an item is removed and re-added in the same layout pass.
This CL takes care of that case and handles it as if item has moved.

Bug: 16081401
Change-Id: Ic0bec5061a4958111c8e43a1cd6634cd90d975b5
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
e0c347f627f8a78d3e5e3e5eaac9c3ae26208689 24-Jun-2014 Yigit Boyar <yboyar@google.com> Run simple animations if adapter has stable ids

Previously, if adapter calls notifyDataSetChanged, RecyclerView would
disable all animations since the world may have changed unexpectedly.

With this change, RecyclerView takes advantage of stable ids when views are
returned from scrap/cache so that we can animate these views to their new
locations / positions.

This change also fixes a bug where cached views would not be recycled if
notifyDataSetChanged is called. Now, if adapter does not have stable ids,
cached views are recycled. If adapter has stable ids, they are retrieved
via stable ids.

Bug: 15692095
Bug: 15857302
Bug: 15632007

Change-Id: Ic321dfeb3438e47a0f7606a857511eb821161a0e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
2d2e8d88103866b631eb0f3805da137ebcfb0275 23-May-2014 Yigit Boyar <yboyar@google.com> StaggeredGridLayoutManager for recycler view

Change-Id: Ie5466806aa0428a9f9f2b9eb6b85dbcfbbaebe5f
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
fe3996cf5af65fe11cc3ed47b67123ec267bd336 18-Jun-2014 Yigit Boyar <yboyar@google.com> Do not scrap invalidated views in RecyclerView

Bug: 15703871
Change-Id: Ib765ddd2ea5b5d897879f2387e8ae6a9f98e555e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
7a59e4b36500bcfddd842376d6c3abe0d9f23d84 18-Jun-2014 Yigit Boyar <yboyar@google.com> Merge "findViewByPosition in RecyclerView should ignore removed children."
5ced882cabdcefbb469e332f6f73983999aad0e5 17-Jun-2014 Yigit Boyar <yboyar@google.com> findViewByPosition in RecyclerView should ignore removed children.

Bug: 15676570
Change-Id: I83aed0f0a8e0fee96fac194dd061ec0ca45ff27a
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
7e9da1a2629b657d56e2f54abd18c6249f3be037 14-Jun-2014 Yigit Boyar <yboyar@google.com> Check view type before re-binding ViewHolders in RecyclerView

Bug: 15596672
Change-Id: Ia42700e400b98b1020dbbba282d383da14d5816c
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
22b6b8163d2e15eb6d0a89906854dec801945f1d 13-Jun-2014 Yigit Boyar <yboyar@google.com> RecyclerView: Fix type-check bug for cached views

Change-Id: I1b6d33d7e1aeeb36e697cb95cd7109a9ac53a909
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
8ae76f91527ce850f155ce960fb9068bcd5d49f9 05-Jun-2014 Yigit Boyar <yboyar@google.com> Fixed RecyclerView position bookkeeping bugs

Bug: 15397591
Bug: 15350129
Bug: 15547859
Change-Id: I54d754eb2b788311048d7557f51967b748b2de3e
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
11b7cfea15306c0d6e4ed7da09f7698df01695df 03-Jun-2014 Yigit Boyar <yboyar@google.com> Fixed RecyclerView scrap matching bug

Bug: 15386994
Change-Id: If742678f83363b20f4e461060bd081ead0f07bf6
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
8edcb0bdeaba6931f9d8154f0c81f57da7ddab2a 31-May-2014 Yigit Boyar <yboyar@google.com> Fix SavedState bugs in LinearLayoutManager

Bug: 15343782, 14271688
Change-Id: Idbd23ce08b51746ccc17d3f2a81a6ed8349bd45c
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
b5f8b4fecb531aee6b359b4968409410aba90817 17-May-2014 Yigit Boyar <yboyar@google.com> Full animation support for LinearLayoutManager

Change-Id: Ie3b265a9f880d68746d1bd193d787f34ea8d0045
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
d7d27e9ebe5c7325e67e1a8af265378bd2056cad 28-Feb-2014 Chet Haase <chet@google.com> Add animations to RecyclerView

This CL adds the basic plumbing for animating item changes in
RecyclerView. It also implements the bare essentials add/delete
animations. When the app specifies that items have been
added/removed (by calling the appropriate Adapter methods), the
RecyclerView will determine the appropriate fading and moving
animations to animate the items being added, removed, and moved
into new locations.

Change-Id: I4fa8686f54c8bfa2ba29c399eea112d33f71689c
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
bde2d5e79f929ce8c54de29c8389695b4d4e9c25 15-May-2014 Chet Haase <chet@google.com> Revert "Remove adapter access from layout manager"

This reverts commit 15a9db9177a871c7b1cd65b8923beac1b9b75174.

Change-Id: Ia80ac4f093c49145a6a2c09d1ea4f9102b195f40
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java
15a9db9177a871c7b1cd65b8923beac1b9b75174 06-May-2014 Yigit Boyar <yboyar@google.com> Remove adapter access from layout manager

Change-Id: I33a48528e3290fa78aaa67237f3b098e010e09d9
/frameworks/support/v7/recyclerview/tests/src/android/support/v7/widget/BaseRecyclerViewInstrumentationTest.java