rubensousa / GravitySnapHelper

A SnapHelper that snaps a RecyclerView to an edge.
Apache License 2.0
5k stars 614 forks source link

Disable flinging #29

Closed ursusursus closed 5 years ago

ursusursus commented 6 years ago

Hi, nice effect but being able to fling which turns into linear scroll really ruins it, id like to mimic view pager physics, exactly how google play does it

thanks

rubensousa commented 6 years ago

Did you try using GravityPagerSnapHelper?

ursusursus commented 6 years ago

Didnt know about it, thanks! Now when Im trying it, its more of what I want, but is there a way to customize it? Say google play one "feels" better, i.e. when I fling it "pages" more items not just one, like GravityPagerSnapHelper

rubensousa commented 6 years ago

Are you using items with the same width as the google play ones? It should be identical.

ursusursus commented 6 years ago

Yes same width. The logic seems fine, but its way to hard to fling it, so Im guessing adjusting som "friction" attribute?

huangjim commented 6 years ago

I also need disable flinging effect like google play,had you solved the problem?

chnouman commented 6 years ago

Hy friends, how to remove this error java.lang.IllegalStateException: An instance of OnFlingListener already set.

i'm adding snaps dynamicaly and this error occur.

rubensousa commented 6 years ago

Closing due to inactivity

rubensousa commented 5 years ago

@ursusursus, this will be added in 2.2.0

rubensousa commented 5 years ago

Released in 2.2.0. Use this: https://github.com/rubensousa/GravitySnapHelper/blob/2.2.0/gravitysnaphelper/src/main/java/com/github/rubensousa/gravitysnaphelper/GravitySnapHelper.java#L300

Check the sample for examples

mradzinski commented 4 years ago

@rubensousa This isn't working as expected. Setting setMaxFlingSizeFraction(1.0F) on a full screen RecyclerView where each item occupies the entire viewport still allows to fling through more than 1 item at a time on vertical layouts (haven't tried with horizontal ones).