Skip to content

Commit

Permalink
Minor variableName refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
TayfunCesur committed Jun 19, 2019
1 parent 5bccce9 commit 2b6ce3c
Showing 1 changed file with 23 additions and 23 deletions.
46 changes: 23 additions & 23 deletions lib/src/main/java/com/tayfuncesur/curvedbottomsheet/CurvedLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,14 @@ class CurvedLayout @JvmOverloads constructor(
private val mControlPoint2 = Point()


private var mNavigationBarWidth: Int = 0
private var mNavigationBarHeight: Int = 0
private var mWidth: Int = 0
private var mHeight: Int = 0


init {

val ta = context.obtainStyledAttributes(attrs, R.styleable.CurvedLayout, defStyleAttr, 0)
fillColor = ta.getColor(R.styleable.CurvedLayout_fillColor, Color.parseColor("#FFFFFF"))
fillColor = ta.getColor(R.styleable.CurvedLayout_fillColor, Color.WHITE)
showControlPoints = ta.getBoolean(R.styleable.CurvedLayout_showControlPoints, false)
ta.recycle()

Expand All @@ -57,8 +57,8 @@ class CurvedLayout @JvmOverloads constructor(

override fun onSizeChanged(w: Int, h: Int, oldw: Int, oldh: Int) {
super.onSizeChanged(w, h, oldw, oldh)
mNavigationBarWidth = width
mNavigationBarHeight = height
mWidth = width
mHeight = height

if (location == CurvedBottomSheet.Location.TOP)
mPath.fillType = Path.FillType.INVERSE_EVEN_ODD
Expand All @@ -67,7 +67,7 @@ class CurvedLayout @JvmOverloads constructor(
if (shape == CurvedBottomSheet.Shape.Concave) {
if (location == CurvedBottomSheet.Location.BOTTOM) {
mCurveStartPoint.set(0, radius)
mCurveEndPoint.set(mNavigationBarWidth, radius)
mCurveEndPoint.set(mWidth, radius)

mControlPoint1.set(
mCurveStartPoint.x + radius * 4 / 3,
Expand All @@ -76,7 +76,7 @@ class CurvedLayout @JvmOverloads constructor(
mControlPoint2.set(mCurveEndPoint.x - radius * 4 / 3, mCurveEndPoint.y - radius)
} else {
mCurveStartPoint.set(0, height - radius)
mCurveEndPoint.set(mNavigationBarWidth, mNavigationBarHeight - radius)
mCurveEndPoint.set(mWidth, mHeight - radius)


mControlPoint1.set(mCurveStartPoint.x + radius, height)
Expand All @@ -86,14 +86,14 @@ class CurvedLayout @JvmOverloads constructor(
} else {
if (location == CurvedBottomSheet.Location.BOTTOM) {
mCurveStartPoint.set(0, 0)
mCurveEndPoint.set(mNavigationBarWidth, 0)
mCurveEndPoint.set(mWidth, 0)


mControlPoint1.set(mCurveStartPoint.x + radius, mCurveStartPoint.y + radius)
mControlPoint2.set(mCurveEndPoint.x - radius, mCurveEndPoint.y + radius)
} else {
mCurveStartPoint.set(0, mNavigationBarHeight)
mCurveEndPoint.set(mNavigationBarWidth, mNavigationBarHeight)
mCurveStartPoint.set(0, mHeight)
mCurveEndPoint.set(mWidth, mHeight)


mControlPoint1.set(mCurveStartPoint.x + radius, height - radius)
Expand All @@ -103,7 +103,7 @@ class CurvedLayout @JvmOverloads constructor(
}
} else {
mCurveStartPoint.set(0, radius)
mCurveEndPoint.set(mNavigationBarWidth, radius)
mCurveEndPoint.set(mWidth, radius)


mControlPoint1.set(mCurveStartPoint.x + radius, mCurveStartPoint.y - radius)
Expand All @@ -125,9 +125,9 @@ class CurvedLayout @JvmOverloads constructor(
mCurveEndPoint.x.toFloat(), mCurveEndPoint.y.toFloat()
)

lineTo(mNavigationBarWidth.toFloat(), 0f)
lineTo(mNavigationBarWidth.toFloat(), mNavigationBarHeight.toFloat())
lineTo(0f, mNavigationBarHeight.toFloat())
lineTo(mWidth.toFloat(), 0f)
lineTo(mWidth.toFloat(), mHeight.toFloat())
lineTo(0f, mHeight.toFloat())
close()
}

Expand All @@ -138,10 +138,10 @@ class CurvedLayout @JvmOverloads constructor(
if (shape == CurvedBottomSheet.Shape.Concave) {
if (location == CurvedBottomSheet.Location.BOTTOM) {
mCurveStartPoint.set(0, radius.toInt())
mCurveEndPoint.set(mNavigationBarWidth, radius.toInt())
mCurveEndPoint.set(mWidth, radius.toInt())
} else {
mCurveStartPoint.set(0, mNavigationBarHeight - radius.toInt())
mCurveEndPoint.set(mNavigationBarWidth, mNavigationBarHeight - radius.toInt())
mCurveStartPoint.set(0, mHeight - radius.toInt())
mCurveEndPoint.set(mWidth, mHeight - radius.toInt())
}
} else {
if (location == CurvedBottomSheet.Location.BOTTOM) {
Expand All @@ -150,17 +150,17 @@ class CurvedLayout @JvmOverloads constructor(
} else {
mControlPoint1.set(
(mCurveStartPoint.x + radius).toInt(),
mNavigationBarHeight - radius.toInt()
mHeight - radius.toInt()
)
mControlPoint2.set(
(mCurveEndPoint.x - radius).toInt(),
mNavigationBarHeight - radius.toInt()
mHeight - radius.toInt()
)
}
}
} else {
mCurveStartPoint.set(0, radius.toInt())
mCurveEndPoint.set(mNavigationBarWidth, radius.toInt())
mCurveEndPoint.set(mWidth, radius.toInt())
mControlPoint1.set(
(mCurveStartPoint.x + radius).toInt(),
(mCurveStartPoint.y - radius).toInt()
Expand All @@ -183,9 +183,9 @@ class CurvedLayout @JvmOverloads constructor(
mCurveEndPoint.x.toFloat(), mCurveEndPoint.y.toFloat()
)

lineTo(mNavigationBarWidth.toFloat(), 0f)
lineTo(mNavigationBarWidth.toFloat(), mNavigationBarHeight.toFloat())
lineTo(0f, mNavigationBarHeight.toFloat())
lineTo(mWidth.toFloat(), 0f)
lineTo(mWidth.toFloat(), mHeight.toFloat())
lineTo(0f, mHeight.toFloat())
close()
invalidate()
}
Expand Down

0 comments on commit 2b6ce3c

Please sign in to comment.