Comments (9)
Hopefully this weekend if I have time. But please check if the code from the develop branch fixes the issue for you. You can copy the 2 classes.
from gravitysnaphelper.
It looks like this bug is actually in the Support Lib's findFirstCompletelyVisibleItemPosition (https://issuetracker.google.com/issues/37019979) - which your listener is relying on - they don't seem to handle the padding correctly when it comes to visibility. Is it possible to use the logic for the snap to also report which item has been snapped instead of using the findFirstCompletelyVisibleItemPosition which doesn't work correctly for clipTopPadding = false?
from gravitysnaphelper.
It looks like findFirstVisibleItemPosition() works when do you a Gravity.Start with padding at the end.
Perhaps an easy fix for this issue would be to add fallback logic to getSnappedPosition() that calls findFirstVisibleItemPosition() if findFirstCompletelyVisibleItemPosition() returns -1? (and vice versa for end/bottom case)
from gravitysnaphelper.
Sorry for the late reply, but I've been busy and can't work on this right now. I saw that you created a PR and I appreciate that. Give me some time to reproduce the behavior you described and then test the fix you proposed. Thanks!
from gravitysnaphelper.
I have a sample project that shows the issue with findFirstCompletelyVisibleItemPosition always returning -1 for a recyclerview with end padding (no snap in this example project - but it should show you the issue) https://github.com/jt-gilkeson/RecyclerViewPaddingDemo
from gravitysnaphelper.
I've merged your fix but noticed that snap is still broken when there's padding on either start or end.
findFirstVisibleItemPosition() doesn't work reliably when there's padding and it breaks the methods that find the target view.
from gravitysnaphelper.
I've managed to fix this tonight. Please check the develop branch.
from gravitysnaphelper.
@rubensousa just to inform. I have this exact case where I want to snap to start but I add padding so te last item also snaps, but the listener is not called. Is there any approximate when this is going to be released?
from gravitysnaphelper.
Released in 2.0
from gravitysnaphelper.
Related Issues (20)
- GridLayoutManager.SpanSizeLookup is not considered HOT 1
- Show the vertical recyclerview below the horizontal HOT 3
- Question: how to snap right away, and also while allowing first&last items to also be in center? HOT 16
- a GravityPagerSnapHelper snap bug in version 1.5 HOT 6
- GravitySnapHelper dont return the first position when the user scroll at (0,0) position HOT 1
- GravitySnapHelper ignores RecyclerView padding in 2.0 HOT 4
- 222 HOT 1
- how set adapter for that HOT 1
- the first item cannot snap to center HOT 2
- Any help on having a Carousel Effect in this? HOT 1
- GravitySnapHelper.SnapListener not callback when scroll to first position. HOT 7
- can not scroll to the top position when call smoothScrollToPosition(0)
- Gravity.BOTTOM with margin HOT 1
- Does this can work like PagerSnapHelper HOT 7
- Library artifacts are published to jcenter only, which will close in 3 months HOT 1
- how to make hightlight snap item center
- Could not download package HOT 2
- Snap with decoration
- IllegalArgumentException when setting snapGravity to center HOT 3
- Prevent snap on items which are bigger than the viewport
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gravitysnaphelper.