From 16c1bd5db8f4f18e1eee8b19006bba5f06a88123 Mon Sep 17 00:00:00 2001 From: ztenghui Date: Mon, 16 Jun 2014 10:30:58 -0700 Subject: Improve constant state for VectorDrawable Now inflation will not cause duplicated constant states. And update tests. Change-Id: I66861e5451c4c10d18756e8522546ea1cb938a55 --- graphics/java/android/graphics/drawable/VectorDrawable.java | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'graphics') 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); -- cgit v1.1