Status Update
Comments
pi...@gmail.com <pi...@gmail.com> #2
Apologies Jeremy, I realized we have a tracking ticket for the sheet APIs specifically:
yb...@google.com <yb...@google.com> #3
Sounds good. I will make it a dup.
yb...@google.com <yb...@google.com> #4
Actually, we should automatically do it when withLoadStateFooter is called as we are the ones creating the concat adapter.
yb...@google.com <yb...@google.com> #5
Btw, you can also fix it more explicitly. Here is an update to your sample to scroll to top on first load:
findViewById<RecyclerView>(R.id.recycler_view_paging).apply {
val linearLayoutManager = LinearLayoutManager(context)
this.layoutManager = linearLayoutManager
this.adapter = samplePagingAdapter.run {
this.withLoadStateFooter(NetworkLoadStateAdapter { this.retry() })
}
var firstLoad = true
samplePagingAdapter.addOnPagesUpdatedListener {
if (samplePagingAdapter.itemCount > 0 && firstLoad) {
linearLayoutManager.scrollToPositionWithOffset(0, 0)
firstLoad = false
}
}
this.setHasFixedSize(true)
}
pe...@gmail.com <pe...@gmail.com> #7
Dit this the trick for me. I hope this is fixed soon, it is an ugly and error-prone workaround...
rn...@gmail.com <rn...@gmail.com> #9
I tried the latest beta version of paging 3, but still the issue persists. Maybe someone else can confim
cl...@google.com <cl...@google.com> #10
Can you please upload a minimal sample project that reproduces the issue you see?
br...@pumble.com <br...@pumble.com> #11
I tried the 3.2.0-rc01 and the issue still persists.
cl...@google.com <cl...@google.com> #12
Re:
ti...@gmail.com <ti...@gmail.com> #13
var isFirstLoad = true //Either in your ViewModel or in your generic component
adapter.apply {
addOnPagesUpdatedListener {
if (itemCount > 0 && firstLoad) {
recyclerView.scrollToPosition(0)
isFirstLoad = false
}
}
}
recyclerView.scrollToPosition(0) works better than linearLayoutManager.scrollToPositionWithOffset(0, 0)
This might help solve the issue for now
Description
Version used: 3.0.0-rc01 (Paging), 2.3.0 (Lifecycle), 2.3.0 (Room)
Devices/Android versions reproduced on: Android 11 and older
Issues:
1. When loading first page for the first time, recycler view scrolled to very bottom
2. Sometimes does not load subsequent page after loading first page for the first time