Status Update
Comments
[Deleted User] <[Deleted User]> #2
[Deleted User] <[Deleted User]> #3
du...@google.com <du...@google.com> #4
Thanks for the update - I am planning on looking into this for 3.1, but have a few other higher priorities at the moment, sorry for the wait!
[Deleted User] <[Deleted User]> #5
Most of the reason we do this, for the record, is we do not use room entities as our model objects. Our repository only exposes plain kotlin objects for expressiveness reasons (like leveraging sum types via sealed. All of the entity types are internal to the repository's module, so the flow emissions have to be mapped to the plain kotlin objects in the repository.
This is contrary to the paging documentation, which appears to assume that emissions from room reactive queries will involve exposing room entity types directly to the viewmodel.
[Deleted User] <[Deleted User]> #6
I have the same problem as well, using withLoadStateHeaderAndFooter
.
Did anyone figure out some workarounds?
I tried overriding LinearLayoutManager
's canScrollVertically to false until data is loaded, but somehow it has no effect, recyler kind of "appears" at the bottom and I can't seem to stop it.
The only scroll event that gets emitted is onScrolled: dx=0 dy=0
. I don't have any outer scrolling containers.
yb...@google.com <yb...@google.com> #7
This is actually RecyclerView getting confused because it does not know that your loading item is not a real "less priority" item.
I added a workaround here:
meanwhile, we should still try to figure out a solution for this but that might require an explicit RecyclerView API change, so might take a while.
[Deleted User] <[Deleted User]> #8
With 3.1 and the workaround mentioned in
du...@google.com <du...@google.com> #9
For those interested, the ticket to track the required change in RecyclerView is here:
ac...@gmail.com <ac...@gmail.com> #10
Hi there, could you share the workaround mention in #7 in this post? cause i could not login this the website
yb...@google.com <yb...@google.com> #11
Sorry about that, wrong internal link :)
here is the public one.
du...@google.com <du...@google.com>
ap...@google.com <ap...@google.com> #12
Branch: androidx-main
commit cfe396b5d0c91bb7f6b85df8359d4d4cda6a9306
Author: Ryan Mentley <ryanmentley@google.com>
Date: Wed Aug 17 19:53:25 2022
Don't anchor views in LinearLayoutManager if viewport is not filled
Fixes: 184874613
Test: New AnchorTest
Change-Id: I54727533ddf2df67e5b9cacda91f1c56b412ed2a
M recyclerview/recyclerview/src/main/java/androidx/recyclerview/widget/LinearLayoutManager.java
A recyclerview/recyclerview/src/androidTest/java/androidx/recyclerview/widget/AnchorTest.kt
Description
Component used: Paging
Version used: 3.0.0-beta03
Devices/Android versions reproduced on: Emulator
Loading data into a list with a load state footer
ConcatAdapter
causes the list to scroll. With eitherwitLoadStateHeaderAndFooter
or without awithLoadState*
-builtConcatAdapter
, the list loads without scrolling.The
ConcatAdapter
invalidation ultimately appears to ultimately be responsible for the list scrolling a little bit.Maybe related to https://issuetracker.google.com/issues/183335970
How far the list scrolls seems to not always be consistent. In the project where I first ran into this, the scroll effect was much more pronounced. The attached zip is of a slightly modified version of the android-paging codelabhttps://github.com/googlecodelabs/android-paging