summaryrefslogtreecommitdiffstats
path: root/graphics/java
diff options
context:
space:
mode:
authorAlan Viverette <alanv@google.com>2014-11-12 22:19:04 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-11-12 22:19:06 +0000
commit667ec63c9ed695ca71f6639f18c31995fb8ff880 (patch)
treebbfb4eaa3dc91b3e0b0e257659406008016ae601 /graphics/java
parent70cb4f3e7131cda1e58c1f6d422e296c4935289d (diff)
parent2d91f63ec20c4b06e87c80451a656462eceba17f (diff)
downloadframeworks_base-667ec63c9ed695ca71f6639f18c31995fb8ff880.zip
frameworks_base-667ec63c9ed695ca71f6639f18c31995fb8ff880.tar.gz
frameworks_base-667ec63c9ed695ca71f6639f18c31995fb8ff880.tar.bz2
Merge "Don't propagate AnimatedStateListDrawable state change to super()" into lmp-mr1-dev
Diffstat (limited to 'graphics/java')
-rw-r--r--graphics/java/android/graphics/drawable/AnimatedStateListDrawable.java14
-rw-r--r--graphics/java/android/graphics/drawable/AnimationDrawable.java11
2 files changed, 14 insertions, 11 deletions
diff --git a/graphics/java/android/graphics/drawable/AnimatedStateListDrawable.java b/graphics/java/android/graphics/drawable/AnimatedStateListDrawable.java
index 84555c6..6d23634 100644
--- a/graphics/java/android/graphics/drawable/AnimatedStateListDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimatedStateListDrawable.java
@@ -142,12 +142,18 @@ public class AnimatedStateListDrawable extends StateListDrawable {
// If we're not already at the target index, either attempt to find a
// valid transition to it or jump directly there.
final int targetIndex = mState.indexOfKeyframe(stateSet);
- final boolean changedIndex = targetIndex != getCurrentIndex()
+ boolean changed = targetIndex != getCurrentIndex()
&& (selectTransition(targetIndex) || selectDrawable(targetIndex));
- // Always call super.onStateChanged() to propagate the state change to
- // the current drawable.
- return super.onStateChange(stateSet) || changedIndex;
+ // We need to propagate the state change to the current drawable, but
+ // we can't call StateListDrawable.onStateChange() without changing the
+ // current drawable.
+ final Drawable current = getCurrent();
+ if (current != null) {
+ changed |= current.setState(stateSet);
+ }
+
+ return changed;
}
private boolean selectTransition(int toIndex) {
diff --git a/graphics/java/android/graphics/drawable/AnimationDrawable.java b/graphics/java/android/graphics/drawable/AnimationDrawable.java
index a8b6c94..2ddf9df 100644
--- a/graphics/java/android/graphics/drawable/AnimationDrawable.java
+++ b/graphics/java/android/graphics/drawable/AnimationDrawable.java
@@ -285,7 +285,6 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An
private void inflateChildElements(Resources r, XmlPullParser parser, AttributeSet attrs,
Theme theme) throws XmlPullParserException, IOException {
- TypedArray a;
int type;
final int innerDepth = parser.getDepth()+1;
@@ -300,7 +299,8 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An
continue;
}
- a = obtainAttributes(r, theme, attrs, R.styleable.AnimationDrawableItem);
+ final TypedArray a = obtainAttributes(r, theme, attrs,
+ R.styleable.AnimationDrawableItem);
final int duration = a.getInt(R.styleable.AnimationDrawableItem_duration, -1);
if (duration < 0) {
@@ -308,14 +308,11 @@ public class AnimationDrawable extends DrawableContainer implements Runnable, An
+ ": <item> tag requires a 'duration' attribute");
}
- final int drawableRes = a.getResourceId(R.styleable.AnimationDrawableItem_drawable, 0);
+ Drawable dr = a.getDrawable(R.styleable.AnimationDrawableItem_drawable);
a.recycle();
- Drawable dr;
- if (drawableRes != 0) {
- dr = r.getDrawable(drawableRes, theme);
- } else {
+ if (dr == null) {
while ((type=parser.next()) == XmlPullParser.TEXT) {
// Empty
}