Created
November 22, 2018 20:15
-
-
Save bitvale/c6b2150971d4a430211a89857b61f64b to your computer and use it in GitHub Desktop.
For Medium article "Android Dynamic Custom View is Easy"
This file contains 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 var iconProgress = 0f | |
set(value) { | |
if (field != value) { | |
field = value | |
val iconOffset = lerp(0f, iconRadius - iconCollapsedWidth / 2, value) | |
iconRect.left = width - switcherCornerRadius - iconCollapsedWidth / 2 - iconOffset | |
iconRect.right = width - switcherCornerRadius + iconCollapsedWidth / 2 + iconOffset | |
postInvalidateOnAnimation() | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment