From 5d2c2560fa63b16a316ee9543c532550775a3a40 Mon Sep 17 00:00:00 2001 From: Brian Pinsard Date: Tue, 17 Jan 2017 23:46:20 +0100 Subject: [PATCH] Dynamic preview dot background + offset numbers converted to constants --- app/src/main/java/com/simplemobiletools/draw/Constants.java | 3 +++ app/src/main/java/com/simplemobiletools/draw/MyCanvas.java | 6 +++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/simplemobiletools/draw/Constants.java b/app/src/main/java/com/simplemobiletools/draw/Constants.java index 6e3696c..fd6e4e4 100644 --- a/app/src/main/java/com/simplemobiletools/draw/Constants.java +++ b/app/src/main/java/com/simplemobiletools/draw/Constants.java @@ -9,4 +9,7 @@ public class Constants { 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_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; } diff --git a/app/src/main/java/com/simplemobiletools/draw/MyCanvas.java b/app/src/main/java/com/simplemobiletools/draw/MyCanvas.java index f8faf97..0d3a219 100644 --- a/app/src/main/java/com/simplemobiletools/draw/MyCanvas.java +++ b/app/src/main/java/com/simplemobiletools/draw/MyCanvas.java @@ -112,10 +112,10 @@ public class MyCanvas extends View { private void drawPreviewDot(Canvas canvas) { mPaint.setColor(Utils.shouldUseWhite(mPaintOptions.color)?Color.WHITE:Color.BLACK); - mPaint.setStrokeWidth(100); - canvas.drawPoint(getWidth()/2, getHeight() - 120, mPaint); + mPaint.setStrokeWidth(mPaintOptions.strokeWidth + Constants.PREVIEW_DOT_STROKE_SIZE); + canvas.drawPoint(getWidth()/2, getHeight() - Constants.PREVIEW_DOT_OFFSET_Y, mPaint); 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) {