diff options
author | Alan Viverette <alanv@google.com> | 2014-11-12 10:24:40 -0800 |
---|---|---|
committer | Alan Viverette <alanv@google.com> | 2014-11-12 10:24:40 -0800 |
commit | f9afb46bf73984d2d29b446d4a306a523fb712ac (patch) | |
tree | 6b236b772d7f09cbfe944cade26cd753e47caf0f /graphics/java | |
parent | 4fc2ea8402b62001b225bf4e1a335c4cbf3b65ea (diff) | |
download | frameworks_base-f9afb46bf73984d2d29b446d4a306a523fb712ac.zip frameworks_base-f9afb46bf73984d2d29b446d4a306a523fb712ac.tar.gz frameworks_base-f9afb46bf73984d2d29b446d4a306a523fb712ac.tar.bz2 |
Fix default attributes in ScaleDrawable
Reverts default scales to correct value of -1, uses existing state
values when updating from typed array.
BUG: 18351309
Change-Id: I45d21fe017a7bea10e3cbda50f6db65d053aa2ec
Diffstat (limited to 'graphics/java')
-rw-r--r-- | graphics/java/android/graphics/drawable/ScaleDrawable.java | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/graphics/java/android/graphics/drawable/ScaleDrawable.java b/graphics/java/android/graphics/drawable/ScaleDrawable.java index 35ef76f..d6d4cb8 100644 --- a/graphics/java/android/graphics/drawable/ScaleDrawable.java +++ b/graphics/java/android/graphics/drawable/ScaleDrawable.java @@ -173,9 +173,9 @@ public class ScaleDrawable extends Drawable implements Drawable.Callback { a, R.styleable.ScaleDrawable_scaleWidth, state.mScaleWidth); state.mScaleHeight = getPercent( a, R.styleable.ScaleDrawable_scaleHeight, state.mScaleHeight); - state.mGravity = a.getInt(R.styleable.ScaleDrawable_scaleGravity, Gravity.LEFT); + state.mGravity = a.getInt(R.styleable.ScaleDrawable_scaleGravity, state.mGravity); state.mUseIntrinsicSizeAsMin = a.getBoolean( - R.styleable.ScaleDrawable_useIntrinsicSizeAsMinimum, false); + R.styleable.ScaleDrawable_useIntrinsicSizeAsMinimum, state.mUseIntrinsicSizeAsMin); final Drawable dr = a.getDrawable(R.styleable.ScaleDrawable_drawable); if (dr != null) { @@ -347,13 +347,16 @@ public class ScaleDrawable extends Drawable implements Drawable.Callback { } final static class ScaleState extends ConstantState { + /** Constant used to disable scaling for a particular dimension. */ + private static final float DO_NOT_SCALE = -1.0f; + int[] mThemeAttrs; int mChangingConfigurations; Drawable mDrawable; - float mScaleWidth = 1.0f; - float mScaleHeight = 1.0f; + float mScaleWidth = DO_NOT_SCALE; + float mScaleHeight = DO_NOT_SCALE; int mGravity = Gravity.LEFT; boolean mUseIntrinsicSizeAsMin = false; |