Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Play sound when item goes through the center position [Question] #81

Open
alinberce opened this issue Jul 16, 2018 · 1 comment
Open
Assignees

Comments

@alinberce
Copy link

Hi,

First of all, awesome awesome library. Thank you for it.
Secondly, I am trying play a small sound each time an item goes through the center position. I've tried implementing my own CarouselLayoutManager.PostLayoutListener but it does not work as extended because this fires only when an item remains stationary. The problem is when doing a smoothScrollToPostion or when the user flings the recyclerview and a lot of scroll happens on the screen.

So what event should I be looking for in order to be notified each time an item goes through the center position, independent if it's programatically or scrolled by the user?

Thank you again for this awesome work.

@alinberce alinberce changed the title Play sound when item goes through the center position Play sound when item goes through the center position [Question] Jul 16, 2018
@mig35
Copy link
Member

mig35 commented Aug 1, 2018

Hi @alinberce

We have OnCenterItemSelectionListener for this situation with addOnItemSelectionListener method. This listener will be fired on every new center item change event. But this listener will be fired when it is a visual change. So imagine that user is scrolling really slow. And the center item now is 0. And when 1 item will be upper then 0 - this event will be fired. So it may take some time while user will move this new 1 item to the center...
So basically I don't have what you need - there is no event when item is going through the center position. May be I will add this event as a part of androidx update.

@mig35 mig35 self-assigned this Aug 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants