Status Update
Comments
an...@google.com <an...@google.com> #2
To be clear, when you say jump pages, do you mean recyclerview is scrolling down, or is viewpager scrolling across multiple fragments?
A repro / sample project demonstrating the issue would definitely be helpful here.
sk...@gmail.com <sk...@gmail.com> #3
You also mentioned alph09 in the title, but alpha07 in the comment - could you specify which version of viewpager and paging you are using?
an...@google.com <an...@google.com>
pa...@gmail.com <pa...@gmail.com> #4
Ah sorry I see that you have used both here, still could you specify which version of viewpager you are using as well?
me...@gmail.com <me...@gmail.com> #5
View Pager 2 : - implementation "androidx.viewpager2:viewpager2:1.0.0"
Paging 3 : - implementation "androidx.paging:paging-runtime-ktx:3.0.0-alpha09"
Example
Attached Video Explanation
When i click slowly on previous button it swipe single page, but if i click quickly multiple times on previous button it start scrolling more than we click and it's not stopping until we click on viewpager.
sh...@gmail.com <sh...@gmail.com> #6
wo...@google.com <wo...@google.com>
wo...@google.com <wo...@google.com> #7
Haven't forgotten this - this is on my queue, just that my queue is quite long :)
ho...@gmail.com <ho...@gmail.com> #8
st...@google.com <st...@google.com> #9
This looks like a weird race scenario where the smooth scroll behavior in RV / ViewPager is attempting to do an animated scroll to an absolute position, but Paging is able to PREPEND items to the front of the list faster than the animation can scroll there.
I noticed that you're attempting to enablePlaceholders to mitigate this by telling Paging the total item count, but you never pass a value for placeholdersBefore / After in the initial result on REFRESH. This will prevent Paging understanding how many placeholder items there are in the list. This is probably something Paging should check for, but the proper solution to this ticket should probably be some kind of relative scrolling behavior on RecyclerView or ViewPager, however I expect boundary cases to be quite annoying to deal with there.
sa...@softcreatr.de <sa...@softcreatr.de> #10
I'm closing this out since it's not a Paging issue, but I'm happy to continue the thread here to help you get a working solution.
The first thing to try would be to return some positive value for placeholdersBefore
and placeholdersAfter
in PagingSource.load()
when LoadParams
is of type LoadParams.Refresh
. From here you'll need to know what the total number of items you want to show in your ViewPager is and add that boundary check to your next / previous buttons.
sa...@gmail.com <sa...@gmail.com> #11
Can you please explain how to access placeholdersBefore in pagingsource.load() method. Where i find the proper documentation of this method...
Thanks
ad...@gmail.com <ad...@gmail.com> #12
val adapter = viewpageradapter()
adapter.snapshot(). placeholdersBefore
But this is not assigned because of val.
So can you please guide me, what i am doing wrong
Thanks
la...@gmail.com <la...@gmail.com> #13
Placeholders are a count of the number of not-yet-loaded items in the dataset, which is returned by PagingSource.load()
in LoadResult.Page(...)
th...@gmail.com <th...@gmail.com> #14
kb...@gmail.com <kb...@gmail.com> #15
You just need to set
[Deleted User] <[Deleted User]> #16
LoadResult.Page(
data = data,
prevKey = if (data.isEmpty()) null else position - 1,
nextKey = if (data.isEmpty()) null else position + 1,
itemsBefore = position
)
I passed position in itemsbefore
I get the error
java.lang.IllegalArgumentException: itemsBefore cannot be negative
So what i am doing actually wrong?
and what value need to pass in itemsBefore and itemsAfter?
ma...@gmail.com <ma...@gmail.com> #17
You want to pass in the number of items in the full dataset that appear before the first item in data
to itemsBefore
and number of items that appear after the last item in data
to itemsAfter
So if you had these items in your db: [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
A sample LoadResult.Page
with itemsBefore
and itemsAfter
set would be:
LoadResult.Page(
data = listOf(4, 5),
prevKey = 3,
nextKey = 6,
itemsBefore = 4,
itemsAfter = 4
)
It doesn't make sense to pass a negative number to itemsBefore
because it implies you've loaded data that shouldn't exist.
jo...@gmail.com <jo...@gmail.com> #18
whenever i set itemsbefore or itemsafter it show me null value
pr...@gmail.com <pr...@gmail.com> #19
Also i updated the logic inside here as well as library to stable version.
pr...@gmail.com <pr...@gmail.com> #20
kb...@gmail.com <kb...@gmail.com> #21
kb...@gmail.com <kb...@gmail.com> #22
<script async
src="
&key=YOUR_API_KEY">
</script>
to...@gmail.com <to...@gmail.com> #23
This is worrying as it's been years since this is reported.
There seems to be no actual fix for this.
[Deleted User] <[Deleted User]> #24
sv...@gmail.com <sv...@gmail.com> #25
[Deleted User] <[Deleted User]> #26
fr...@gmail.com <fr...@gmail.com> #27
is...@gmail.com <is...@gmail.com> #28
Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive.
Well I considered it and determined that I can't.
ad...@gmail.com <ad...@gmail.com> #29
jh...@google.com <jh...@google.com> #30
Please provide a small self-contained example in e.g. JSFiddle that reliably reproduces this issue if possible, we can't investigate further otherwise.
su...@gmail.com <su...@gmail.com> #31
ma...@monarchy.io <ma...@monarchy.io> #32
po...@gmail.com <po...@gmail.com> #34
So many years and still not fixed
Description
[Violation] Added non-passive event listener to a scroll-blocking 'touchmove' event. Consider marking event handler as 'passive' to make the page more responsive. util.js:40
[Violation] Added non-passive event listener to a scroll-blocking 'wheel' event. Consider marking event handler as 'passive' to make the page more responsive. js?key=AIzaSyDttV9fifwdx7FgugmWj1bNtLAvNRQC39c&sensor=false:99
[Violation] Added non-passive event listener to a scroll-blocking 'mousewheel' event. Consider marking event handler as 'passive' to make the page more responsive. js?key=AIzaSyDttV9fifwdx7FgugmWj1bNtLAvNRQC39c&sensor=false:99