rubensousa / GravitySnapHelper

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

Center Snap with support to snap to edge items #21

Closed XtreeIvI closed 5 years ago

XtreeIvI commented 7 years ago

GravirySnapHelper is awesome comparing to default LinearSnapHelper. But It would be perfect if it is support also Gravity.CENTER and simultaneously snap to first and last item if scrolled to one of the edges. Regretfully LinearSnapHelper (though snap to center) can't snap to side items as your GravirySnapHelper does. So in order your GravirySnapHelper become far more superior you should add Gravity.CENTER. Thanks. Also I found that if I set snapToLastItem(true) it does not snap, though it snap to edge items by default.

rubensousa commented 7 years ago

I don't understand why Gravity.CENTER support should be added. Care to explain an use case for this?

XtreeIvI commented 7 years ago

actually Gravity.CENTER with ability to snap for first and last item. LinearSnapHelper does not support snap for side items.

bobymicroby commented 7 years ago

in LinearSnapHelper you dont have the snapListener, so +1 for Gravity.CENTER :)

rubensousa commented 7 years ago

@XtreeIvI, it doesn't make sense (in my opinion) to support CENTER and then snapping first and last items at the same time. That means it'll only be centered before the first scroll. After the first scroll, it'll either be snapped at START or END.

I'll consider adding CENTER support to replace the need for using 2 different SnapHelpers.

GLiccardo commented 7 years ago

actually Gravity.CENTER with ability to snap for first and last item. LinearSnapHelper does not support snap for side items.

+1 It is important when you have the first and last items with margins to screen edges

rubensousa commented 5 years ago

@XtreeIvI this will be added in 2.2.0

rubensousa commented 5 years ago

Released in 2.2.0. Just pass Gravity.CENTER and you get this behavior by default