Skip to content

Commit

Permalink
Merge pull request #4 from ac-opensource/feature/support-for-vector-d…
Browse files Browse the repository at this point in the history
…rawables

Add support for Vector Drawables
  • Loading branch information
GIGAMOLE committed Apr 11, 2016
2 parents 186517a + bc6101d commit 25c7a16
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions library/src/main/java/com/gigamole/library/NavigationTabBar.java
Original file line number Diff line number Diff line change
Expand Up @@ -1240,9 +1240,18 @@ public static class Model {

public Model(final Drawable icon, final int color) {
mColor = color;
mIcon = icon != null ? ((BitmapDrawable) icon).getBitmap() :
Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);

if (icon != null) {
if(icon instanceof BitmapDrawable) {
mIcon = ((BitmapDrawable) icon).getBitmap();
} else {
mIcon = Bitmap.createBitmap(icon.getIntrinsicWidth(),icon.getIntrinsicHeight(), Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(mIcon);
icon.setBounds(0, 0, canvas.getWidth(), canvas.getHeight());
icon.draw(canvas);
}
} else {
mIcon = Bitmap.createBitmap(1, 1, Bitmap.Config.RGB_565);
}
mBadgeAnimator.addListener(new Animator.AnimatorListener() {

@Override
Expand Down

0 comments on commit 25c7a16

Please sign in to comment.