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

Add on attached listener to CountdownView to fix #45 #46

Closed
wants to merge 6 commits into from

Conversation

ahaverty
Copy link

Added an on attached interface listener to allow starting the countdown again with specified millisecond long to fix #45
Added in the event that onDetachedFromWindow is called (which stops the countdown)
onDetached occurs if list items in a recycler view go out of view

Added an on attached interface listener to allow starting the countdown again with specified millisecond long
Added in the event that onDetachedFromWindow is called (which stops the countdown)
onDetached occurs if list items in a recycler view go out of view
@ahaverty
Copy link
Author

ahaverty commented May 19, 2017

The idea is to start the countdownView and also set the listener in your onBindViewHolder of a recyclerView

For example:

 countdownView.start(eta);
 //Fix the out-of-view pause issue, tell it what time to use once it reattaches
 countdownView.setOnAttachedToWindowListener(() -> time - System.currentTimeMillis());

@ahaverty
Copy link
Author

Confirming that it has fixed the pause issues in my own recycler view. Thanks for a great repo @iwgang 👌

@ahaverty ahaverty closed this Jun 2, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Countdowns stop in a recycler view when items scroll out of view
1 participant