Giter VIP home page Giter VIP logo

Comments (9)

rubensousa avatar rubensousa commented on May 29, 2024 1

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.

jt-gilkeson avatar jt-gilkeson commented on May 29, 2024

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.

jt-gilkeson avatar jt-gilkeson commented on May 29, 2024

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.

rubensousa avatar rubensousa commented on May 29, 2024

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.

jt-gilkeson avatar jt-gilkeson commented on May 29, 2024

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.

rubensousa avatar rubensousa commented on May 29, 2024

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.

rubensousa avatar rubensousa commented on May 29, 2024

I've managed to fix this tonight. Please check the develop branch.

from gravitysnaphelper.

llleodeleon avatar llleodeleon commented on May 29, 2024

@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.

rubensousa avatar rubensousa commented on May 29, 2024

Released in 2.0

from gravitysnaphelper.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.