Dynamic preview dot background + offset numbers converted to constants

This commit is contained in:
Brian Pinsard 2017-01-17 23:46:20 +01:00
parent ab28e2d2c7
commit 5d2c2560fa
2 changed files with 6 additions and 3 deletions

View File

@ -9,4 +9,7 @@ public class Constants {
public static final String IS_FIRST_RUN = "is_first_run"; public static final String IS_FIRST_RUN = "is_first_run";
public static final String IS_DARK_THEME = "is_dark_theme"; public static final String IS_DARK_THEME = "is_dark_theme";
public static final String IS_STROKE_WIDTH_BAR_ENABLED = "is_stroke_width_bar_enabled"; public static final String IS_STROKE_WIDTH_BAR_ENABLED = "is_stroke_width_bar_enabled";
// canvas
public static final int PREVIEW_DOT_STROKE_SIZE = 5;
public static final int PREVIEW_DOT_OFFSET_Y = 120;
} }

View File

@ -112,10 +112,10 @@ public class MyCanvas extends View {
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(100); mPaint.setStrokeWidth(mPaintOptions.strokeWidth + Constants.PREVIEW_DOT_STROKE_SIZE);
canvas.drawPoint(getWidth()/2, getHeight() - 120, mPaint); canvas.drawPoint(getWidth()/2, getHeight() - Constants.PREVIEW_DOT_OFFSET_Y, mPaint);
changePaint(mPaintOptions); changePaint(mPaintOptions);
canvas.drawPoint(getWidth()/2, getHeight() - 120, mPaint); canvas.drawPoint(getWidth()/2, getHeight() - Constants.PREVIEW_DOT_OFFSET_Y, mPaint);
} }
private void changePaint(PaintOptions paintOptions) { private void changePaint(PaintOptions paintOptions) {