Skip to content

Instantly share code, notes, and snippets.

@chris-horner
Created September 17, 2018 00:46
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chris-horner/c6d8f0b5e0573aad920b16ff84d676cb to your computer and use it in GitHub Desktop.
Save chris-horner/c6d8f0b5e0573aad920b16ff84d676cb to your computer and use it in GitHub Desktop.
class BottomNavChangeHandler : TransitionChangeHandler() {
override fun getTransition(container: ViewGroup, from: View?, to: View?,
isPush: Boolean): Transition {
if (from == null || to == null) {
throw IllegalArgumentException("from and to must not be null.")
}
val transition = TransitionSet()
.addTransition(Fade())
.addTransition(Scale(0.95f))
.setDuration(170)
.addTarget(to)
transition.doOnEnd {
if (container.childCount > 1) container.removeView(from)
}
return transition
}
override fun executePropertyChanges(container: ViewGroup, from: View?, to: View?,
transition: Transition?, isPush: Boolean) {
if (from == null || to == null) {
throw IllegalArgumentException("from and to must not be null.")
}
if (to.parent == null) container.addView(to)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment