Verified
Status Update
Comments
yb...@google.com <yb...@google.com>
cc...@google.com <cc...@google.com> #2
me...@smpete.com <me...@smpete.com> #3
hi,
what do you think about moving the error handler's method into the callback class?
android.arch.persistence.db.SupportSQLiteOpenHelper.Callback#onCorruption(SQLiteDatabase db)
what do you think about moving the error handler's method into the callback class?
android.arch.persistence.db.SupportSQLiteOpenHelper.Callback#onCorruption(SQLiteDatabase db)
cc...@google.com <cc...@google.com> #4
SupportSQLiteDatabase as arg for the callback method right? Works for me.
Description
Version used: alpha 5
Devices/Android versions reproduced on: Pixel (8.1) and Emulator (7.0)
When placeholders are disabled, the `RecyclerView` will sometimes jump positions when data is added or removed from the database. This has been observed in my own project which doesn't use Room as well as the PagingSample which does. Both use a subclass of `PositionalDataSource`.
It appears what happens is the `loadInitial` call that happens on the new `DataSource` has an incorrect start position. It appears to be the page size. This causes the next page to be loaded first, followed by data that is visibly on screen. Once the initial page is loaded, the `RecyclerView` sees this as the full data set so the view appears "scrolled" to that position. Then the subsequent `loadRange` call comes in that loads from position 0. Since the `RecyclerView` sees this as added data it does not scroll.
Here is what happened to the `RecyclerView` in the attached screenrecord:
App Started:
- onItemRangeInserted. positionStart: 0 itemCount: 90
Added cheese "0":
- onItemRangeRemoved. positionStart: 89 itemCount: 1
- onItemRangeInserted. positionStart: 0 itemCount: 1
Remove Abbaye de Belloc:
- onItemRangeInserted. positionStart: 90 itemCount: 31
- onItemRangeRemoved. positionStart: 0 itemCount: 31
- onItemRangeInserted. positionStart: 0 itemCount: 30
- Sample project to trigger the issue.
This can be reproduced in the PagingSample project (