Skip to content

Commit

Permalink
A couple of minor improvements
Browse files Browse the repository at this point in the history
 + added hasFired() method to the view
 + do not draw shape if it is empty, i.e. radius == 0 or rect.isEmpty()
  • Loading branch information
Anton Danshin committed Sep 3, 2015
1 parent 8c80257 commit 62c7e8a
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,10 @@ private void updateDismissButton() {
}
}

public boolean hasFired() {
return mPrefsManager.hasFired();
}

/**
* REDRAW LISTENER - this ensures we redraw after activity finishes laying out
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,9 @@ public void setRadius(int radius) {

@Override
public void draw(Canvas canvas, Paint paint, int x, int y, int padding) {
canvas.drawCircle(x, y, radius + padding, paint);
if (radius > 0) {
canvas.drawCircle(x, y, radius + padding, paint);
}
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,15 @@ private void init() {

@Override
public void draw(Canvas canvas, Paint paint, int x, int y, int padding) {
canvas.drawRect(
rect.left + x - padding,
rect.top + y - padding,
rect.right + x + padding,
rect.bottom + y + padding,
paint
);
rect.offset(-x, -y);
if (!rect.isEmpty()) {
canvas.drawRect(
rect.left + x - padding,
rect.top + y - padding,
rect.right + x + padding,
rect.bottom + y + padding,
paint
);
}
}

@Override
Expand Down

0 comments on commit 62c7e8a

Please sign in to comment.