Last active
January 28, 2021 07:32
-
-
Save akexorcist/ea39edd43df0aaaf640995517ca05820 to your computer and use it in GitHub Desktop.
Build Coupon UI - Top right corner (https://medium.com/@akexorcist/how-we-built-developer-friendly-coupon-ui-in-android-part-2-78933730d335)
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
val canvas: Canvas = /* ... */ | |
val areaWidth = canvas.width | |
val areaHeight = canvas.height | |
val borderWidth = 2 | |
val cornerRadius = 10 | |
val semiCircleRadius = 20 | |
val path = Path().apply { | |
/* ... */ | |
// Top right corner | |
arcTo( | |
left = areaWidth - ((cornerRadius * 2f) + (borderWidth / 2f)), | |
top = borderWidth / 2f, | |
right = areaWidth - (borderWidth / 2f), | |
bottom = (cornerRadius * 2f) + (borderWidth / 2f), | |
startAngle = 270f, | |
sweepAngle = 90f, | |
forceMoveTo = false | |
) | |
/* ... */ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment