Add dither XML attribute support to Gradient and ShapeDrawable.
Change-Id: I4b60a0ba6766b7e7b176e78dc7f15f8467e2b890
This commit is contained in:
@@ -624,6 +624,8 @@ public class GradientDrawable extends Drawable {
|
||||
|
||||
int shapeType = a.getInt(
|
||||
com.android.internal.R.styleable.GradientDrawable_shape, RECTANGLE);
|
||||
boolean dither = a.getBoolean(
|
||||
com.android.internal.R.styleable.GradientDrawable_dither, false);
|
||||
|
||||
if (shapeType == RING) {
|
||||
st.mInnerRadius = a.getDimensionPixelSize(
|
||||
@@ -645,10 +647,11 @@ public class GradientDrawable extends Drawable {
|
||||
a.recycle();
|
||||
|
||||
setShape(shapeType);
|
||||
|
||||
setDither(dither);
|
||||
|
||||
int type;
|
||||
|
||||
final int innerDepth = parser.getDepth()+1;
|
||||
final int innerDepth = parser.getDepth() + 1;
|
||||
int depth;
|
||||
while ((type=parser.next()) != XmlPullParser.END_DOCUMENT
|
||||
&& ((depth=parser.getDepth()) >= innerDepth
|
||||
|
||||
@@ -286,7 +286,7 @@ public class ShapeDrawable extends Drawable {
|
||||
protected boolean inflateTag(String name, Resources r, XmlPullParser parser,
|
||||
AttributeSet attrs) {
|
||||
|
||||
if (name.equals("padding")) {
|
||||
if ("padding".equals(name)) {
|
||||
TypedArray a = r.obtainAttributes(attrs,
|
||||
com.android.internal.R.styleable.ShapeDrawablePadding);
|
||||
setPadding(
|
||||
@@ -315,7 +315,10 @@ public class ShapeDrawable extends Drawable {
|
||||
int color = mShapeState.mPaint.getColor();
|
||||
color = a.getColor(com.android.internal.R.styleable.ShapeDrawable_color, color);
|
||||
mShapeState.mPaint.setColor(color);
|
||||
|
||||
|
||||
boolean dither = a.getBoolean(com.android.internal.R.styleable.ShapeDrawable_dither, false);
|
||||
mShapeState.mPaint.setDither(dither);
|
||||
|
||||
setIntrinsicWidth((int)
|
||||
a.getDimension(com.android.internal.R.styleable.ShapeDrawable_width, 0f));
|
||||
setIntrinsicHeight((int)
|
||||
|
||||
Reference in New Issue
Block a user