diff options
Diffstat (limited to 'core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt')
-rw-r--r-- | core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt b/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt new file mode 100644 index 0000000..9e668d0 --- /dev/null +++ b/core/src/main/kotlin/ca/allanwang/kau/utils/TransitionUtils.kt @@ -0,0 +1,19 @@ +package ca.allanwang.kau.utils + +import android.support.transition.Transition +import android.support.transition.TransitionSet + +/** + * Created by Allan Wang on 2017-06-24. + */ +class TransitionEndListener(val onEnd: (transition: Transition) -> Unit) : Transition.TransitionListener { + override fun onTransitionEnd(transition: Transition) = onEnd(transition) + override fun onTransitionResume(transition: Transition) {} + override fun onTransitionPause(transition: Transition) {} + override fun onTransitionCancel(transition: Transition) {} + override fun onTransitionStart(transition: Transition) {} +} + +@KauUtils fun TransitionSet.addEndListener(onEnd: (transition: Transition) -> Unit) { + addListener(TransitionEndListener(onEnd)) +}
\ No newline at end of file |