Skip to content

Instantly share code, notes, and snippets.

@akexorcist
Last active January 21, 2021 19:13
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 akexorcist/fc8f154d19aada4955a8c064aaa948a5 to your computer and use it in GitHub Desktop.
Save akexorcist/fc8f154d19aada4955a8c064aaa948a5 to your computer and use it in GitHub Desktop.
Build Coupon UI - Setup path
class CouponLayout : FrameLayout {
/* ... */
private fun setupPath() {
path.apply {
reset()
moveTo(/* Start point */)
topRightCorner (areaWidth, areaHeight, borderWidth, cornerRadius)
rightSemiCircle (areaWidth, areaHeight, borderWidth, semiCircleRadius)
bottomRightCorner (areaWidth, areaHeight, borderWidth, cornerRadius)
bottomSemiCircle (areaWidth, areaHeight, borderWidth, semiCircleRadius)
bottomLeftCorner (areaWidth, areaHeight, borderWidth, cornerRadius)
leftSemiCircle (areaWidth, areaHeight, borderWidth, semiCircleRadius)
topLeftCorner (areaWidth, areaHeight, borderWidth, cornerRadius)
topSemiCircle (areaWidth, areaHeight, borderWidth, semiCircleRadius)
close()
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment