Skip to content

Instantly share code, notes, and snippets.

@kazufusa
Created February 20, 2021 14:09
Show Gist options
  • Save kazufusa/e56c3f496d2c915872a0a9a98725a359 to your computer and use it in GitHub Desktop.
Save kazufusa/e56c3f496d2c915872a0a9a98725a359 to your computer and use it in GitHub Desktop.
private fun fadeIn(view: View) {
view.apply {
alpha = 0f
visibility = View.VISIBLE
animate()
.alpha(1f)
.setDuration(300)
.setListener(null)
}
}
private fun fadeOut(view: View) {
view.animate()
.alpha(0f)
.setDuration(300)
.setListener(object : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
view.visibility = View.INVISIBLE
}
})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment