Skip to content

Instantly share code, notes, and snippets.

View TayfunCesur's full-sized avatar
💭
The quieter you become the more you are able to hear

Tayfun Cesur TayfunCesur

💭
The quieter you become the more you are able to hear
View GitHub Profile
bottomSheetBehavior.setBottomSheetCallback(object : BottomSheetBehavior.BottomSheetCallback() {
override fun onSlide(p0: View, p1: Float) {
val ra = radius - (radius * p1)
(p0 as CurvedLayout).setCorner(ra)
}
override fun onStateChanged(p0: View, p1: Int) {
}
})
fun setCorner(radius: Float) {
mCurveStartPoint.set(0, radius.toInt())
mCurveEndPoint.set(mWidth, radius.toInt())
//Apply our new points to our path like above
mPath.apply {
//...
invalidate()
}
}
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
//...
mPath.apply {
//1.Step
moveTo(
mCurveStartPoint.x.toFloat(),
mCurveStartPoint.y.toFloat()
)
//2.Step
override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
mCurveStartPoint.set(0, radius)
mCurveEndPoint.set(w, radius)
mControlPoint1.set(
mCurveStartPoint.x + radius,
mCurveStartPoint.y - radius)
mControlPoint2.set(