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 clicksFlow extension #204

Open
LouisCAD opened this issue Aug 13, 2019 · 0 comments
Open

Add clicksFlow extension #204

LouisCAD opened this issue Aug 13, 2019 · 0 comments
Labels
New feature up for grabs Available for external contributions. Add a comment if you want to work on a PR.

Comments

@LouisCAD
Copy link
Owner

It's pretty straightfowards to implement correctly with back-pressure support out of the box using awaitOneClick(…) already in Views Coroutines:

fun View.clicksFlow(
    disableAfterClick: Boolean = true,
    hideAfterClick: Boolean = false
): Flow<Unit> = flow {
    while (true) emit(
        awaitOneClick(
            disableAfterClick = disableAfterClick,
            hideAfterClick = hideAfterClick
        )
    )
}
@LouisCAD LouisCAD added New feature up for grabs Available for external contributions. Add a comment if you want to work on a PR. labels Aug 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
New feature up for grabs Available for external contributions. Add a comment if you want to work on a PR.
Projects
None yet
Development

No branches or pull requests

1 participant