applm / CarouselWidget

Carousel displaying list of items with selected item in the middle
Other
47 stars 33 forks source link

How to implement scroll snap point effect? #11

Open kiranboghra opened 8 years ago

kiranboghra commented 8 years ago

When user stop scrolling and MotionEvent.ACTION_UP is called in Carousel selected item should move to center point (Scroll snap point), is there any way or suggestionfor this functionality?

applm commented 8 years ago

Check my other repository. Deprecated one. CoverFlow there has this implemented. Dne 5. 3. 2016 10:55 dopoledne napsal uživatel "kiran boghra" < notifications@github.com>:

When user stop scrolling and MotionEvent.ACTION_UP is called in Carousel selected item should move to center point (Scroll snap point), is there any way or suggestionfor this functionality?

— Reply to this email directly or view it on GitHub https://github.com/applm/CarouselWidget/issues/11.

kiranboghra commented 8 years ago

please provide link.

gintechsystems commented 8 years ago

@kiranboghra If you still need help with this I am implemented in my forked release.

ashenriques commented 8 years ago

@gintechsystems in your repository did u managed how to make scroll to position to work? I tried it but I was unable to make it work properly.

One issue I have when I just uncomment the function "carousel.scrollToItemPosition(position);" in onClickListener is that some views do a visual flickering.

The other issue it's a little more complex to explain. But my idea is to scroll to a card that it's not displayed in the screen. For instance if I turn off the loop, and set mCount to length * 5; I will have 25 cards. So if I set the card's onLongClickListener method to call scrollToPosition for the hardcoded value 24 (the last card), independently in which card I click in theory I should always jump to the last card. But what happens is that sometimes I jump to the last card -> 24, other times to 23. When I make the jump from the first card -> 0 the app just crashes.

Do you have any idea how to solve this?

gintechsystems commented 8 years ago

@ashenriques Take this to my repo please, I have gotten that to work using setSelection, I believe.

ashenriques commented 8 years ago

@gintechsystems you have your issues section disabled in your repo (try this -> http://programmers.stackexchange.com/questions/179468/forking-a-repo-on-github-but-allowing-new-issues-on-the-fork. The method setSelection centers the clicked card, but does not animate the scroll to it.