|
39 | 39 | import android.graphics.ColorFilter; |
40 | 40 | import android.graphics.Paint; |
41 | 41 | import android.graphics.Path; |
42 | | -import android.graphics.PixelFormat; |
43 | 42 | import android.graphics.Rect; |
44 | 43 | import android.graphics.RectF; |
45 | 44 | import android.graphics.Typeface; |
|
48 | 47 | import android.support.annotation.ColorRes; |
49 | 48 | import android.support.annotation.DimenRes; |
50 | 49 | import android.support.v4.content.ContextCompat; |
| 50 | +import android.text.TextPaint; |
51 | 51 | import android.util.Log; |
52 | 52 |
|
53 | 53 | import com.mikepenz.iconics.typeface.IIcon; |
@@ -131,7 +131,12 @@ protected IconicsDrawable(Context context, final ITypeface typeface, final IIcon |
131 | 131 | } |
132 | 132 |
|
133 | 133 | private void prepare() { |
134 | | - mIconPaint = new Paint(Paint.ANTI_ALIAS_FLAG); |
| 134 | + mIconPaint = new TextPaint(Paint.ANTI_ALIAS_FLAG); |
| 135 | + mIconPaint.setStyle(Paint.Style.FILL); |
| 136 | + mIconPaint.setTextAlign(Paint.Align.CENTER); |
| 137 | + mIconPaint.setUnderlineText(false); |
| 138 | + mIconPaint.setAntiAlias(true); |
| 139 | + |
135 | 140 | mBackgroundPaint = new Paint(Paint.ANTI_ALIAS_FLAG); |
136 | 141 |
|
137 | 142 | mContourPaint = new Paint(Paint.ANTI_ALIAS_FLAG); |
@@ -776,7 +781,7 @@ public int getIntrinsicHeight() { |
776 | 781 |
|
777 | 782 | @Override |
778 | 783 | public int getOpacity() { |
779 | | - return PixelFormat.OPAQUE; |
| 784 | + return this.mAlpha; |
780 | 785 | } |
781 | 786 |
|
782 | 787 |
|
@@ -805,6 +810,11 @@ public void setColorFilter(ColorFilter cf) { |
805 | 810 | mIconPaint.setColorFilter(cf); |
806 | 811 | } |
807 | 812 |
|
| 813 | + @Override |
| 814 | + public void clearColorFilter() { |
| 815 | + mIconPaint.setColorFilter(null); |
| 816 | + } |
| 817 | + |
808 | 818 | /** |
809 | 819 | * Creates a BitMap to use in Widgets or anywhere else |
810 | 820 | * |
|
0 commit comments