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

Provide Kotlin extensions #13

Closed
turastory opened this issue Jun 20, 2019 · 2 comments
Closed

Provide Kotlin extensions #13

turastory opened this issue Jun 20, 2019 · 2 comments

Comments

@turastory
Copy link

AdditiveAnimator.animate(this)
    .addEndAction(object : AnimationEndListener() {
        override fun onAnimationEnd(wasCancelled: Boolean) {
            
        }
    })

Function above can be simplified using typealias and lambda.

typealias AnimationEndListener =
    (wasCancelled: Boolean) -> Unit

fun AdditiveAnimator.addEndAction(listener: AnimationEndListener) {
    addEndAction(object : AnimationEndListener() {
        override fun onAnimationEnd(wasCancelled: Boolean) {
            listener(wasCancelled)
        }
    })
}

// Use
AdditiveAnimator.animate(this)
    .addEndAction { wasCancelled ->
         
    }

Do you have any plans to do something like this? (Support Kotlin)

@davidganster
Copy link
Member

Hi,

which version of the library are you using?
The new syntax should already be supported via Java Lambdas since 1.7.1!
Please let me know if upgrading to this version fixes this issue.

I just realized I didn't make an official release for that because I wanted to tidy something up – I'll fix that today and update the readme/releases for the latest version!

@turastory
Copy link
Author

Yep, I used version 1.6.2. When I upgrade to 1.7.2 it fixes the issue.

And thanks for updates - visibility animations are pretty useful!

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

No branches or pull requests

2 participants