Skip to content

Commit

Permalink
Use setBackground instead of deprecated function
Browse files Browse the repository at this point in the history
  • Loading branch information
wangzhengyi committed Sep 30, 2015
1 parent 61064ab commit 8eb9251
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions BadgeView/src/com/jauker/widget/BadgeView.java
Original file line number Diff line number Diff line change
Expand Up @@ -81,15 +81,14 @@ private void init() {
setBadgeCount(0);
}

@SuppressWarnings("deprecation")
public void setBackground(int dipRadius, int badgeColor) {
int radius = dip2Px(dipRadius);
float[] radiusArray = new float[] { radius, radius, radius, radius, radius, radius, radius, radius };

RoundRectShape roundRect = new RoundRectShape(radiusArray, null, null);
ShapeDrawable bgDrawable = new ShapeDrawable(roundRect);
bgDrawable.getPaint().setColor(badgeColor);
setBackgroundDrawable(bgDrawable);
setBackground(bgDrawable);
}

/**
Expand Down

0 comments on commit 8eb9251

Please sign in to comment.