Skip to content

Commit

Permalink
Merge pull request #7 from cdflynn/cf_api15_inflate_error
Browse files Browse the repository at this point in the history
fix an API15 issue where inflating crossview inside an action bar men…
  • Loading branch information
cdflynn committed May 12, 2015
2 parents e36928b + 64b2ab7 commit 6c2a1de
Showing 1 changed file with 5 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ public class CrossView extends View {
private float mArcLengthLeft;
private float mArcLengthRight;

private Paint mPaint = new Paint();
private Paint mPaint;
private int mColor = DEFAULT_COLOR;
private RectF mRect;
private PathMeasure mPathMeasure;
Expand Down Expand Up @@ -169,11 +169,13 @@ public void setPaddingRelative(int start, int top, int end, int bottom) {

public void setColor(int argb) {
mColor = argb;
if (mPaint == null) {
mPaint = new Paint();
}
mPaint.setColor(argb);
invalidate();
}


/**
* Tell this view to switch states from cross to plus, or back, using the default animation duration.
* @return an integer flag that represents the new state after toggling.
Expand Down Expand Up @@ -253,6 +255,7 @@ private void setPercent(float percent) {
* or an operating system callback like {@link #onLayout(boolean, int, int, int, int)}.
*/
private void init() {
mPaint = new Paint();
mRect = new RectF();
mRect.left = getPaddingLeft();
mRect.right = getWidth() - getPaddingRight();
Expand Down

0 comments on commit 6c2a1de

Please sign in to comment.