Skip to content

Instantly share code, notes, and snippets.

@krossovochkin
Created January 18, 2020 12: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 krossovochkin/def897c0b75a62bad7f31210b4fc8a24 to your computer and use it in GitHub Desktop.
Save krossovochkin/def897c0b75a62bad7f31210b4fc8a24 to your computer and use it in GitHub Desktop.
Theme_1
private fun setTheme(theme: ThemeManager.Theme, animate: Boolean = true) {
if (!animate) {
ThemeManager.theme = theme
return
}
if (imageView.isVisible) {
return
}
val w = container.measuredWidth
val h = container.measuredHeight
val bitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888)
val canvas = Canvas(bitmap)
container.draw(canvas)
imageView.setImageBitmap(bitmap)
imageView.isVisible = true
val finalRadius = hypot(w.toFloat(), h.toFloat())
ThemeManager.theme = theme
val anim = ViewAnimationUtils.createCircularReveal(imageView, w / 2, h / 2, finalRadius, 0f)
anim.duration = 400L
anim.doOnEnd {
imageView.setImageDrawable(null)
imageView.isVisible = false
}
anim.start()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment