diff options
author | ztenghui <ztenghui@google.com> | 2014-06-16 10:30:58 -0700 |
---|---|---|
committer | ztenghui <ztenghui@google.com> | 2014-06-18 12:55:22 -0700 |
commit | 16c1bd5db8f4f18e1eee8b19006bba5f06a88123 (patch) | |
tree | 2c4d15d0c4a80dcb10cc2df45e40ad30747e40dd /graphics | |
parent | 5adf8ee451085ed6106b7dbadc6d8dcd9d90722b (diff) | |
download | frameworks_base-16c1bd5db8f4f18e1eee8b19006bba5f06a88123.zip frameworks_base-16c1bd5db8f4f18e1eee8b19006bba5f06a88123.tar.gz frameworks_base-16c1bd5db8f4f18e1eee8b19006bba5f06a88123.tar.bz2 |
Improve constant state for VectorDrawable
Now inflation will not cause duplicated constant states.
And update tests.
Change-Id: I66861e5451c4c10d18756e8522546ea1cb938a55
Diffstat (limited to 'graphics')
-rw-r--r-- | graphics/java/android/graphics/drawable/VectorDrawable.java | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/graphics/java/android/graphics/drawable/VectorDrawable.java b/graphics/java/android/graphics/drawable/VectorDrawable.java index c3c1bca..a1e1f76 100644 --- a/graphics/java/android/graphics/drawable/VectorDrawable.java +++ b/graphics/java/android/graphics/drawable/VectorDrawable.java @@ -147,10 +147,12 @@ public class VectorDrawable extends Drawable { } private VectorDrawable(VectorDrawableState state, Resources res, Theme theme) { - mVectorState = new VectorDrawableState(state); - - if (theme != null && canApplyTheme()) { + if (theme != null && state.canApplyTheme()) { + // If we need to apply a theme, implicitly mutate. + mVectorState = new VectorDrawableState(state); applyTheme(theme); + } else { + mVectorState = state; } mTintFilter = updateTintFilter(mTintFilter, state.mTint, state.mTintMode); |