Created
January 18, 2020 12:07
-
-
Save krossovochkin/cb9f62537a14bbbf94cfe4c97ce24ded to your computer and use it in GitHub Desktop.
Theme_1_setup
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| private fun setTheme(theme: Theme) { | |
| 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()) | |
| TODO("Change theme over all views") | |
| val anim = ViewAnimationUtils.createCircularReveal(container, w / 2, h / 2, 0f, finalRadius) | |
| 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