Skip to content
This repository has been archived by the owner on Nov 14, 2018. It is now read-only.

Return receiver for AnimatorListener-related extensions #133

Open
jlnstrk opened this issue Feb 5, 2018 · 1 comment
Open

Return receiver for AnimatorListener-related extensions #133

jlnstrk opened this issue Feb 5, 2018 · 1 comment

Comments

@jlnstrk
Copy link

jlnstrk commented Feb 5, 2018

Usually we construct animators starting with a call to e.g. ValueAnimator#ofXY, continuing with configuration in builder style - because the api allows it. Until now, and also with the current KTX implementation, this builder would get broken as soon as we want to attach an AnimatorListener (or even an AnimatorUpdateListener for ValueAnimator), making code look super ugly.

Instead of returning the AnimatorListener that we passed in the very same statement (which makes it kinda redundant), we could return the function receiver, the Animator we're adding our listener to, in order to maintain builder flow.

@carlosefonseca
Copy link

I noticed that too. I think the purpose might be to allow you to remove the listener if you want. I just wrap the call in an apply {} block.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants