Skip to content

Commit

Permalink
Merge 90a9c6c into f2d6d0a
Browse files Browse the repository at this point in the history
  • Loading branch information
George Kankava committed Mar 8, 2016
2 parents f2d6d0a + 90a9c6c commit bbfa447
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,13 +66,13 @@ private Long createImageTiles(Bitmap original, int n) {
int w = original.getWidth();
int h = original.getHeight();

int tile_width = w / n;
int tile_height = h / n;
int tileWidth = w / n;
int tileHeight = h / n;

for (int y = 0; y + tile_height <= h; y += tile_height) {
for (int x = 0; x + tile_width <= w; x += tile_width) {
Bitmap tile = Bitmap.createBitmap(original, x, y, tile_width,
tile_height);
for (int y = 0; y + tileHeight <= h; y += tileHeight) {
for (int x = 0; x + tileWidth <= w; x += tileWidth) {
Bitmap tile = Bitmap.createBitmap(original, x, y, tileWidth,
tileHeight);
saveTile(tile, x, y, originalId);
}
}
Expand Down
4 changes: 1 addition & 3 deletions app/src/main/java/com/jigdraw/draw/views/DrawingView.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public class DrawingView extends View {
private int paintColor = 0xFF660000;
private Canvas drawCanvas;
private Bitmap canvasBitmap;
private float brushSize, lastBrushSize;
private float brushSize;

/**
* Create new drawing view with context and attributes and setting up the
Expand All @@ -62,7 +62,6 @@ public DrawingView(Context context, AttributeSet attrs) {
*/
private void init() {
brushSize = getResources().getInteger(R.integer.medium_size);
lastBrushSize = brushSize;
drawPath = new Path();
drawPaint = new Paint();
drawPaint.setColor(paintColor);
Expand Down Expand Up @@ -128,7 +127,6 @@ public void setColor(int newColor) {
* @param newSize the new color
*/
public void setBrushSize(float newSize) {
lastBrushSize = brushSize;
brushSize = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP,
newSize, getResources().getDisplayMetrics());
drawPaint.setStrokeWidth(brushSize);
Expand Down
18 changes: 9 additions & 9 deletions app/src/main/java/com/jigdraw/draw/views/JigsawGridView.java
Original file line number Diff line number Diff line change
Expand Up @@ -181,15 +181,6 @@ public JigsawGridView(Context context) {
init(context);
}

public void init(Context context) {
super.setOnScrollListener(mScrollListener);
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
mSmoothScrollAmountAtEdge = (int) (SMOOTH_SCROLL_AMOUNT_AT_EDGE
* metrics.density + 0.5f);
mOverlapIfSwitchStraightLine = getResources().getDimensionPixelSize(
R.dimen.dgv_overlap_if_switch_straight_line);
}

public JigsawGridView(Context context, AttributeSet attrs) {
super(context, attrs);
init(context);
Expand All @@ -200,6 +191,15 @@ public JigsawGridView(Context context, AttributeSet attrs, int defStyle) {
init(context);
}

public void init(Context context) {
super.setOnScrollListener(mScrollListener);
DisplayMetrics metrics = context.getResources().getDisplayMetrics();
mSmoothScrollAmountAtEdge = (int) (SMOOTH_SCROLL_AMOUNT_AT_EDGE
* metrics.density + 0.5f);
mOverlapIfSwitchStraightLine = getResources().getDimensionPixelSize(
R.dimen.dgv_overlap_if_switch_straight_line);
}

public static boolean isPreLollipop() {
return Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP;
}
Expand Down

0 comments on commit bbfa447

Please sign in to comment.