summaryrefslogtreecommitdiffstats
path: root/graphics
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-06-01 16:11:32 -0700
committerAlan Viverette <alanv@google.com>2014-06-01 16:11:32 -0700
commit982c59a55f8f11d0e26be93780b292adacd56f49 (patch)
tree292599c33005494ef075fda0dfae5b0831760a26 /graphics
parent377801463ef75d7c14f3ef6a346d8ddccb2a4045 (diff)
downloadframeworks_base-982c59a55f8f11d0e26be93780b292adacd56f49.zip
frameworks_base-982c59a55f8f11d0e26be93780b292adacd56f49.tar.gz
frameworks_base-982c59a55f8f11d0e26be93780b292adacd56f49.tar.bz2
Fix padding for GradientDrawable
BUG: 15197745 Change-Id: Ibd1c20dd8ba8c7ffbf65031be4ca9813304d4d0f
Diffstat (limited to 'graphics')
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java9
1 files changed, 6 insertions, 3 deletions
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index f82acc3..b2d61ec 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -1153,6 +1153,10 @@ public class GradientDrawable extends Drawable {
// Extract the theme attributes, if any.
st.mAttrPadding = a.extractThemeAttrs();
+ if (st.mPadding == null) {
+ st.mPadding = new Rect();
+ }
+
final Rect pad = st.mPadding;
pad.set(a.getDimensionPixelOffset(R.styleable.GradientDrawablePadding_left, pad.left),
a.getDimensionPixelOffset(R.styleable.GradientDrawablePadding_top, pad.top),
@@ -1424,8 +1428,6 @@ public class GradientDrawable extends Drawable {
}
final static class GradientState extends ConstantState {
- public final Rect mPadding = new Rect();
-
public int mChangingConfigurations;
public int mShape = RECTANGLE;
public int mGradient = LINEAR_GRADIENT;
@@ -1442,6 +1444,7 @@ public class GradientDrawable extends Drawable {
public float mStrokeDashGap;
public float mRadius; // use this if mRadiusArray is null
public float[] mRadiusArray;
+ public Rect mPadding;
public int mWidth = -1;
public int mHeight = -1;
public float mInnerRadiusRatio = DEFAULT_INNER_RADIUS_RATIO;
@@ -1491,7 +1494,7 @@ public class GradientDrawable extends Drawable {
mRadiusArray = state.mRadiusArray.clone();
}
if (state.mPadding != null) {
- mPadding.set(state.mPadding);
+ mPadding = new Rect(state.mPadding);
}
mWidth = state.mWidth;
mHeight = state.mHeight;