Reformat code
This commit is contained in:
parent
5d2c2560fa
commit
7ca648004b
|
@ -66,14 +66,14 @@ public class MyCanvas extends View {
|
||||||
|
|
||||||
public void setColor(int newColor) {
|
public void setColor(int newColor) {
|
||||||
mPaintOptions.color = newColor;
|
mPaintOptions.color = newColor;
|
||||||
if(mIsStrokeWidthBarEnabled) {
|
if (mIsStrokeWidthBarEnabled) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setStrokeWidth(float newStrokeWidth){
|
public void setStrokeWidth(float newStrokeWidth) {
|
||||||
mPaintOptions.strokeWidth = newStrokeWidth;
|
mPaintOptions.strokeWidth = newStrokeWidth;
|
||||||
if(mIsStrokeWidthBarEnabled) {
|
if (mIsStrokeWidthBarEnabled) {
|
||||||
invalidate();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -105,17 +105,17 @@ public class MyCanvas extends View {
|
||||||
changePaint(mPaintOptions);
|
changePaint(mPaintOptions);
|
||||||
canvas.drawPath(mPath, mPaint);
|
canvas.drawPath(mPath, mPaint);
|
||||||
|
|
||||||
if(mIsStrokeWidthBarEnabled && !mIsSaving) {
|
if (mIsStrokeWidthBarEnabled && !mIsSaving) {
|
||||||
drawPreviewDot(canvas);
|
drawPreviewDot(canvas);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void drawPreviewDot(Canvas canvas) {
|
private void drawPreviewDot(Canvas canvas) {
|
||||||
mPaint.setColor(Utils.shouldUseWhite(mPaintOptions.color)?Color.WHITE:Color.BLACK);
|
mPaint.setColor(Utils.shouldUseWhite(mPaintOptions.color) ? Color.WHITE : Color.BLACK);
|
||||||
mPaint.setStrokeWidth(mPaintOptions.strokeWidth + Constants.PREVIEW_DOT_STROKE_SIZE);
|
mPaint.setStrokeWidth(mPaintOptions.strokeWidth + Constants.PREVIEW_DOT_STROKE_SIZE);
|
||||||
canvas.drawPoint(getWidth()/2, getHeight() - Constants.PREVIEW_DOT_OFFSET_Y, mPaint);
|
canvas.drawPoint(getWidth() / 2, getHeight() - Constants.PREVIEW_DOT_OFFSET_Y, mPaint);
|
||||||
changePaint(mPaintOptions);
|
changePaint(mPaintOptions);
|
||||||
canvas.drawPoint(getWidth()/2, getHeight() - Constants.PREVIEW_DOT_OFFSET_Y, mPaint);
|
canvas.drawPoint(getWidth() / 2, getHeight() - Constants.PREVIEW_DOT_OFFSET_Y, mPaint);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void changePaint(PaintOptions paintOptions) {
|
private void changePaint(PaintOptions paintOptions) {
|
||||||
|
|
|
@ -74,7 +74,7 @@ public class MainActivity extends SimpleActivity implements MyCanvas.PathsChange
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
boolean isStrokeWidthBarEnabled = mConfig.getIsStrokeWidthBarEnabled();
|
boolean isStrokeWidthBarEnabled = mConfig.getIsStrokeWidthBarEnabled();
|
||||||
mStrokeWidthBar.setVisibility(isStrokeWidthBarEnabled? View.VISIBLE:View.GONE);
|
mStrokeWidthBar.setVisibility(isStrokeWidthBarEnabled ? View.VISIBLE : View.GONE);
|
||||||
mMyCanvas.setIsStrokeWidthBarEnabled(isStrokeWidthBarEnabled);
|
mMyCanvas.setIsStrokeWidthBarEnabled(isStrokeWidthBarEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue