Skip to content

Instantly share code, notes, and snippets.

@jossiwolf
Last active March 8, 2019 10:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jossiwolf/37753bb1af051860d7f8d836e17fd29e to your computer and use it in GitHub Desktop.
Save jossiwolf/37753bb1af051860d7f8d836e17fd29e to your computer and use it in GitHub Desktop.
/**
* Helper class for [MotionLayout.TransitionListener] which provides Android Support Annotations and proper parameter names
*/
abstract class TransitionListener: MotionLayout.TransitionListener {
/**
* Called when a transition has been completed
*/
override fun onTransitionCompleted(view: MotionLayout, @IdRes constraintSetId: Int) = Unit
/**
* Called when a [KeyTrigger] is triggered
*/
override fun onTransitionTrigger(view: MotionLayout, @IdRes triggerId: Int, isPositive: Boolean, progress: Float) = Unit
/**
* Called when a transition has been started
*/
@Deprecated("This is not being called due to a bug in MotionLayout. This will be fixed in Alpha 4 (hopefully).")
override fun onTransitionStarted(view: MotionLayout, @IdRes startConstraintSetId: Int, @IdRes endConstraintSetId: Int) = Unit
/**
* Called when the transition or its progress changes
*/
override fun onTransitionChange(view: MotionLayout, @IdRes startConstraintSetId: Int, @IdRes endConstraintSetId: Int, progress: Float) = Unit
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment