Last active
November 12, 2018 12:28
-
-
Save IslamBesto/fe3248ca2b6be61a25fe4a64ca5a098c to your computer and use it in GitHub Desktop.
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
@Override | |
protected void onSizeChanged(int w, int h, int oldw, int oldh) { | |
super.onSizeChanged(w, h, oldw, oldh); | |
// get width and height of navigation bar | |
// Navigation bar bounds (width & height) | |
mNavigationBarWidth = getWidth(); | |
mNavigationBarHeight = getHeight(); | |
// the coordinates (x,y) of the start point before curve | |
mFirstCurveStartPoint.set((mNavigationBarWidth / 2) - (CURVE_CIRCLE_RADIUS * 2) - (CURVE_CIRCLE_RADIUS / 3), 0); | |
// the coordinates (x,y) of the end point after curve | |
mFirstCurveEndPoint.set(mNavigationBarWidth / 2, CURVE_CIRCLE_RADIUS + (CURVE_CIRCLE_RADIUS / 4)); | |
// same thing for the second curve | |
mSecondCurveStartPoint = mFirstCurveEndPoint; | |
mSecondCurveEndPoint.set((mNavigationBarWidth / 2) + (CURVE_CIRCLE_RADIUS * 2) + (CURVE_CIRCLE_RADIUS / 3), 0); | |
// the coordinates (x,y) of the 1st control point on a cubic curve | |
mFirstCurveControlPoint1.set(mFirstCurveStartPoint.x + CURVE_CIRCLE_RADIUS + (CURVE_CIRCLE_RADIUS / 4), mFirstCurveStartPoint.y); | |
// the coordinates (x,y) of the 2nd control point on a cubic curve | |
mFirstCurveControlPoint2.set(mFirstCurveEndPoint.x - (CURVE_CIRCLE_RADIUS * 2) + CURVE_CIRCLE_RADIUS, mFirstCurveEndPoint.y); | |
mSecondCurveControlPoint1.set(mSecondCurveStartPoint.x + (CURVE_CIRCLE_RADIUS * 2) - CURVE_CIRCLE_RADIUS, mSecondCurveStartPoint.y); | |
mSecondCurveControlPoint2.set(mSecondCurveEndPoint.x - (CURVE_CIRCLE_RADIUS + (CURVE_CIRCLE_RADIUS / 4)), mSecondCurveEndPoint.y); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Please keep practice to share variable initialization and declaration.