Skip to content

Commit bad236d

Browse files
Merge pull request #16 from happyfoxinc/development
Update build.gradle and refactored properties in DrawingView
2 parents e0ea2c1 + ab3f2f4 commit bad236d

File tree

2 files changed

+23
-23
lines changed

2 files changed

+23
-23
lines changed

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@ buildscript {
44
mavenCentral()
55
}
66
dependencies {
7-
classpath 'com.android.tools.build:gradle:0.12.+'
7+
classpath 'com.android.tools.build:gradle:1.0.0+'
88
}
99
}

helpstack/src/com/tenmiles/helpstack/activities/DrawingView.java

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,9 @@
1616

1717
public class DrawingView extends View {
1818

19-
private Path drawPath;
20-
private Paint drawPaint;
21-
private Canvas drawCanvas;
19+
private Path mPath;
20+
private Paint mPaint;
21+
private Canvas mCanvas;
2222

2323
private Paint canvasPaint;
2424
private Bitmap canvasBitmap;
@@ -36,46 +36,46 @@ public class DrawingView extends View {
3636
public DrawingView(Context context, AttributeSet attrs) {
3737
super(context, attrs);
3838

39-
drawPath = new Path();
40-
drawPaint = new Paint();
39+
mPath = new Path();
40+
mPaint = new Paint();
4141

42-
drawPaint.setColor(paintColor);
42+
mPaint.setColor(paintColor);
4343

44-
drawPaint.setAntiAlias(true);
45-
drawPaint.setStrokeWidth(brushSize);
46-
drawPaint.setStyle(Paint.Style.STROKE);
47-
drawPaint.setStrokeJoin(Paint.Join.ROUND);
48-
drawPaint.setStrokeCap(Paint.Cap.ROUND);
44+
mPaint.setAntiAlias(true);
45+
mPaint.setStrokeWidth(brushSize);
46+
mPaint.setStyle(Paint.Style.STROKE);
47+
mPaint.setStrokeJoin(Paint.Join.ROUND);
48+
mPaint.setStrokeCap(Paint.Cap.ROUND);
4949

5050
canvasPaint = new Paint(Paint.DITHER_FLAG);
5151
}
5252

5353
public void setCanvasBitmap(Bitmap bitmap) {
5454
cachedBitmap = bitmap;
55-
drawCanvas.drawColor(Color.BLACK);
55+
mCanvas.drawColor(Color.BLACK);
5656
Bitmap mutableBitmap = bitmap.copy(Bitmap.Config.ARGB_8888, true);
5757

58-
calculateResizeRatio(bitmap, drawCanvas);
58+
calculateResizeRatio(bitmap, mCanvas);
5959
Bitmap resizedBitmap = Bitmap.createScaledBitmap(mutableBitmap, resizedWidth, resizedHeight, false);
6060

6161
int leftStart = getLeftStart(resizedWidth);
6262
int topStart = getTopStart(resizedHeight);
6363

64-
drawCanvas.drawBitmap(resizedBitmap, leftStart, topStart, drawPaint);
64+
mCanvas.drawBitmap(resizedBitmap, leftStart, topStart, mPaint);
6565
}
6666

6767
@Override
6868
protected void onSizeChanged(int w, int h, int oldw, int oldh) {
6969
super.onSizeChanged(w, h, oldw, oldh);
7070

7171
canvasBitmap = Bitmap.createBitmap(w, h, Bitmap.Config.ARGB_8888);
72-
drawCanvas = new Canvas(canvasBitmap);
72+
mCanvas = new Canvas(canvasBitmap);
7373
}
7474

7575
@Override
7676
protected void onDraw(Canvas canvas) {
7777
canvas.drawBitmap(canvasBitmap, 0, 0, canvasPaint);
78-
canvas.drawPath(drawPath, drawPaint);
78+
canvas.drawPath(mPath, mPaint);
7979
}
8080

8181
@Override
@@ -85,15 +85,15 @@ public boolean onTouchEvent(MotionEvent event) {
8585

8686
switch (event.getAction()) {
8787
case MotionEvent.ACTION_DOWN:
88-
drawPath.moveTo(touchX, touchY);
88+
mPath.moveTo(touchX, touchY);
8989
break;
9090
case MotionEvent.ACTION_MOVE:
91-
drawPath.lineTo(touchX, touchY);
91+
mPath.lineTo(touchX, touchY);
9292
break;
9393
case MotionEvent.ACTION_UP:
94-
drawCanvas.drawPath(drawPath, drawPaint);
94+
mCanvas.drawPath(mPath, mPaint);
9595
setIsEdited(true);
96-
drawPath.reset();
96+
mPath.reset();
9797
activateClearOptionInActivity(true);
9898
break;
9999
default:
@@ -108,11 +108,11 @@ public void setColor(String newColor) {
108108
invalidate();
109109

110110
paintColor = Color.parseColor(newColor);
111-
drawPaint.setColor(paintColor);
111+
mPaint.setColor(paintColor);
112112
}
113113

114114
public void clearChanges() {
115-
drawPath.reset();
115+
mPath.reset();
116116
setCanvasBitmap(cachedBitmap);
117117
setIsEdited(false);
118118
activateClearOptionInActivity(false);

0 commit comments

Comments
 (0)