summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-02-23 15:57:08 -0800
committerRomain Guy <romainguy@google.com>2011-02-23 15:57:08 -0800
commited7894352f8addfe3d0da75cc7fe8bc6fef201dc (patch)
tree053155ce4b553b46b9a31d2b014d93ac6e610002 /graphics
parent39c512b623eff1d7a7b17f68a42723fbda9bf483 (diff)
downloadframeworks_base-ed7894352f8addfe3d0da75cc7fe8bc6fef201dc.zip
frameworks_base-ed7894352f8addfe3d0da75cc7fe8bc6fef201dc.tar.gz
frameworks_base-ed7894352f8addfe3d0da75cc7fe8bc6fef201dc.tar.bz2
Add dither XML attribute support to Gradient and ShapeDrawable.
Change-Id: I4b60a0ba6766b7e7b176e78dc7f15f8467e2b890
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java7
-rw-r--r--graphics/java/android/graphics/drawable/ShapeDrawable.java7
2 files changed, 10 insertions, 4 deletions
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 2089751..33f050c 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -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
diff --git a/graphics/java/android/graphics/drawable/ShapeDrawable.java b/graphics/java/android/graphics/drawable/ShapeDrawable.java
index cb8774d..4445b6a 100644
--- a/graphics/java/android/graphics/drawable/ShapeDrawable.java
+++ b/graphics/java/android/graphics/drawable/ShapeDrawable.java
@@ -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)