Skip to content

Commit

Permalink
fixed issue #5
Browse files Browse the repository at this point in the history
  • Loading branch information
zagum committed Dec 30, 2016
1 parent 645cb08 commit 05e7493
Showing 1 changed file with 7 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -200,23 +200,18 @@ protected void onDraw(Canvas canvas) {
}

@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
calculateArrowMetrics();
protected void onSizeChanged(int width, int height, int oldWidth, int oldHeight) {
super.onSizeChanged(width, height, oldWidth, oldHeight);
calculateArrowMetrics(width, height);
updateArrowPath();
}

private void calculateArrowMetrics() {
final int width = getMeasuredWidth();
final int height = getMeasuredHeight();
final int arrowMaxHeight = height - 2 * padding;
int arrowWidth = width - 2 * padding;
arrowWidth = arrowMaxHeight >= arrowWidth ? arrowWidth : arrowMaxHeight;

private void calculateArrowMetrics(int width, int height) {
final int arrowMaxWidth = (height >= width ? width : height);
if (useDefaultPadding) {
padding = (int) (PADDING_PROPORTION * width);
padding = (int) (PADDING_PROPORTION * arrowMaxWidth);
}

final int arrowWidth = arrowMaxWidth - 2 * padding;
float thickness = (int) (arrowWidth * THICKNESS_PROPORTION);
paint.setStrokeWidth(thickness);

Expand Down

0 comments on commit 05e7493

Please sign in to comment.