diff options
| author | 2014-08-27 22:29:19 +0000 | |
|---|---|---|
| committer | 2014-08-27 22:29:19 +0000 | |
| commit | 327710e36f5e9d3a7eef9a23a1ba317fada0a030 (patch) | |
| tree | 3e96ee18645f9090931472b63f9031da57e6621e | |
| parent | 12ed679911ff5c62fb9877e0dc7ec720d805c231 (diff) | |
| parent | d7853e576301bf68e96148a0b9e52085bfc7cf95 (diff) | |
Merge "Preserve inner drawable bounds and level on mutate" into lmp-dev
7 files changed, 46 insertions, 33 deletions
diff --git a/core/res/res/drawable/progress_horizontal_material.xml b/core/res/res/drawable/progress_horizontal_material.xml index d7440a99e4f8..7a1079cef82d 100644 --- a/core/res/res/drawable/progress_horizontal_material.xml +++ b/core/res/res/drawable/progress_horizontal_material.xml @@ -17,7 +17,8 @@ <layer-list xmlns:android="http://schemas.android.com/apk/res/android"> <item android:id="@id/background"> <nine-patch android:src="@drawable/progress_mtrl_alpha" - android:tint="?attr/colorControlNormal" /> + android:tint="?attr/colorControlNormal" + android:alpha="0.5" /> </item> <item android:id="@id/secondaryProgress"> <scale android:scaleWidth="100%"> diff --git a/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java b/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java index 0bc4fdfb7877..4c8b4f1f2cd0 100644 --- a/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java +++ b/graphics/java/android/graphics/drawable/AnimatedRotateDrawable.java @@ -346,22 +346,24 @@ public class AnimatedRotateDrawable extends Drawable implements Drawable.Callbac private boolean mCanConstantState; private boolean mCheckedConstantState; - public AnimatedRotateState(AnimatedRotateState source, AnimatedRotateDrawable owner, + public AnimatedRotateState(AnimatedRotateState orig, AnimatedRotateDrawable owner, Resources res) { - if (source != null) { + if (orig != null) { if (res != null) { - mDrawable = source.mDrawable.getConstantState().newDrawable(res); + mDrawable = orig.mDrawable.getConstantState().newDrawable(res); } else { - mDrawable = source.mDrawable.getConstantState().newDrawable(); + mDrawable = orig.mDrawable.getConstantState().newDrawable(); } mDrawable.setCallback(owner); - mDrawable.setLayoutDirection(source.mDrawable.getLayoutDirection()); - mPivotXRel = source.mPivotXRel; - mPivotX = source.mPivotX; - mPivotYRel = source.mPivotYRel; - mPivotY = source.mPivotY; - mFramesCount = source.mFramesCount; - mFrameDuration = source.mFrameDuration; + mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection()); + mDrawable.setBounds(orig.mDrawable.getBounds()); + mDrawable.setLevel(orig.mDrawable.getLevel()); + mPivotXRel = orig.mPivotXRel; + mPivotX = orig.mPivotX; + mPivotYRel = orig.mPivotYRel; + mPivotY = orig.mPivotY; + mFramesCount = orig.mFramesCount; + mFrameDuration = orig.mFrameDuration; mCanConstantState = mCheckedConstantState = true; } } diff --git a/graphics/java/android/graphics/drawable/ClipDrawable.java b/graphics/java/android/graphics/drawable/ClipDrawable.java index f11637644af9..61ef81b6e7c4 100644 --- a/graphics/java/android/graphics/drawable/ClipDrawable.java +++ b/graphics/java/android/graphics/drawable/ClipDrawable.java @@ -285,6 +285,8 @@ public class ClipDrawable extends Drawable implements Drawable.Callback { } mDrawable.setCallback(owner); mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection()); + mDrawable.setBounds(orig.mDrawable.getBounds()); + mDrawable.setLevel(orig.mDrawable.getLevel()); mOrientation = orig.mOrientation; mGravity = orig.mGravity; mCheckedConstantState = mCanConstantState = true; diff --git a/graphics/java/android/graphics/drawable/InsetDrawable.java b/graphics/java/android/graphics/drawable/InsetDrawable.java index dd0f06fc2edb..a20b6d8f0d88 100644 --- a/graphics/java/android/graphics/drawable/InsetDrawable.java +++ b/graphics/java/android/graphics/drawable/InsetDrawable.java @@ -400,6 +400,8 @@ public class InsetDrawable extends Drawable implements Drawable.Callback { } mDrawable.setCallback(owner); mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection()); + mDrawable.setBounds(orig.mDrawable.getBounds()); + mDrawable.setLevel(orig.mDrawable.getLevel()); mInsetLeft = orig.mInsetLeft; mInsetTop = orig.mInsetTop; mInsetRight = orig.mInsetRight; diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index 43bc89ab59d9..001ed8860761 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -961,20 +961,22 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { // Default empty constructor. } - ChildDrawable(ChildDrawable or, LayerDrawable owner, Resources res) { + ChildDrawable(ChildDrawable orig, LayerDrawable owner, Resources res) { if (res != null) { - mDrawable = or.mDrawable.getConstantState().newDrawable(res); + mDrawable = orig.mDrawable.getConstantState().newDrawable(res); } else { - mDrawable = or.mDrawable.getConstantState().newDrawable(); + mDrawable = orig.mDrawable.getConstantState().newDrawable(); } mDrawable.setCallback(owner); - mDrawable.setLayoutDirection(or.mDrawable.getLayoutDirection()); - mThemeAttrs = or.mThemeAttrs; - mInsetL = or.mInsetL; - mInsetT = or.mInsetT; - mInsetR = or.mInsetR; - mInsetB = or.mInsetB; - mId = or.mId; + mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection()); + mDrawable.setBounds(orig.mDrawable.getBounds()); + mDrawable.setLevel(orig.mDrawable.getLevel()); + mThemeAttrs = orig.mThemeAttrs; + mInsetL = orig.mInsetL; + mInsetT = orig.mInsetT; + mInsetR = orig.mInsetR; + mInsetB = orig.mInsetB; + mId = orig.mId; } } diff --git a/graphics/java/android/graphics/drawable/RotateDrawable.java b/graphics/java/android/graphics/drawable/RotateDrawable.java index 63b9e0291815..70482a616d6b 100644 --- a/graphics/java/android/graphics/drawable/RotateDrawable.java +++ b/graphics/java/android/graphics/drawable/RotateDrawable.java @@ -507,21 +507,23 @@ public class RotateDrawable extends Drawable implements Drawable.Callback { private boolean mCanConstantState; private boolean mCheckedConstantState; - public RotateState(RotateState source, RotateDrawable owner, Resources res) { - if (source != null) { + public RotateState(RotateState orig, RotateDrawable owner, Resources res) { + if (orig != null) { if (res != null) { - mDrawable = source.mDrawable.getConstantState().newDrawable(res); + mDrawable = orig.mDrawable.getConstantState().newDrawable(res); } else { - mDrawable = source.mDrawable.getConstantState().newDrawable(); + mDrawable = orig.mDrawable.getConstantState().newDrawable(); } mDrawable.setCallback(owner); - mDrawable.setLayoutDirection(source.mDrawable.getLayoutDirection()); - mPivotXRel = source.mPivotXRel; - mPivotX = source.mPivotX; - mPivotYRel = source.mPivotYRel; - mPivotY = source.mPivotY; - mFromDegrees = mCurrentDegrees = source.mFromDegrees; - mToDegrees = source.mToDegrees; + mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection()); + mDrawable.setBounds(orig.mDrawable.getBounds()); + mDrawable.setLevel(orig.mDrawable.getLevel()); + mPivotXRel = orig.mPivotXRel; + mPivotX = orig.mPivotX; + mPivotYRel = orig.mPivotYRel; + mPivotY = orig.mPivotY; + mFromDegrees = mCurrentDegrees = orig.mFromDegrees; + mToDegrees = orig.mToDegrees; mCanConstantState = mCheckedConstantState = true; } } diff --git a/graphics/java/android/graphics/drawable/ScaleDrawable.java b/graphics/java/android/graphics/drawable/ScaleDrawable.java index a95447481359..b40038a69e54 100644 --- a/graphics/java/android/graphics/drawable/ScaleDrawable.java +++ b/graphics/java/android/graphics/drawable/ScaleDrawable.java @@ -295,6 +295,8 @@ public class ScaleDrawable extends Drawable implements Drawable.Callback { } mDrawable.setCallback(owner); mDrawable.setLayoutDirection(orig.mDrawable.getLayoutDirection()); + mDrawable.setBounds(orig.mDrawable.getBounds()); + mDrawable.setLevel(orig.mDrawable.getLevel()); mScaleWidth = orig.mScaleWidth; mScaleHeight = orig.mScaleHeight; mGravity = orig.mGravity; |