x1 = area_width - ((semi_circle_radius / 2) + (border_width / 2))
y1 = (area_height / 2) - (semi_circle_radius / 2)
x2 = area_width + ((semi_circle_radius / 2) - (border_width / 2))
y2 = (area_height / 2) + (semi_circle_radius / 2)
start_angle = 270
sweep_angle = -180
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 { | |
/* ... */ | |
// Right edge semi circle |
start_angle = 270
sweep_angle = 90
x1 = area_width - ((corner_radius * 2) + (border_width / 2))
y1 = border_width / 2
x2 = area_width - (border_width / 2)
y2 = (corner_radius * 2) + (border_width / 2)
x = area_width - (corner_radius + (border_width / 2))
y = border_width / 2
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 |
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 { | |
/* ... */ | |
moveTo( |
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 paint: Paint = /* ... */ | |
val path = Path().apply { | |
reset() | |
moveTo(/* Start point */) | |
arcTo(/* Top right corner */) // 1 | |
arcTo(/* Right edge semi circle */) // 2 | |
arcTo(/* Bottom right corner */) // 3 | |
arcTo(/* Bottom edge semi circle */) // 4 | |
arcTo(/* Bottom left corner */) // 5 |
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
class CouponLayout : FrameLayout { | |
/* ... */ | |
override fun onDraw(canvas: Canvas?) { | |
super.onDraw(canvas) | |
// Draw something with `canvas` | |
} | |
} |
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
<?xml version="1.0" encoding="utf-8"?> | |
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android" | |
xmlns:app="http://schemas.android.com/apk/res-auto" | |
xmlns:tools="http://schemas.android.com/tools" | |
android:layout_width="match_parent" | |
android:layout_height="match_parent"> | |
<androidx.constraintlayout.widget.ConstraintLayout | |
android:layout_width="match_parent" | |
android:layout_height="wrap_content" |