summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2011-07-22 16:04:00 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2011-07-22 16:04:00 -0700
commit5bae58dff90025dd1419bd7508d17bbd32c26beb (patch)
tree21110a844288b64a5650ecb896cd11da34778195
parent556d0476e14803b406ddff7fe4c27baf1bf58334 (diff)
parentd4745a689f36211afaff396874d78b1d5202762d (diff)
downloadframeworks_base-5bae58dff90025dd1419bd7508d17bbd32c26beb.zip
frameworks_base-5bae58dff90025dd1419bd7508d17bbd32c26beb.tar.gz
frameworks_base-5bae58dff90025dd1419bd7508d17bbd32c26beb.tar.bz2
Merge "Nested alpha animations should cause invalidates too Bug #5041061"
-rw-r--r--core/java/android/view/ViewGroup.java2
-rw-r--r--core/java/android/view/animation/AlphaAnimation.java8
-rw-r--r--core/java/android/view/animation/Animation.java9
-rw-r--r--core/java/android/view/animation/AnimationSet.java23
4 files changed, 41 insertions, 1 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java
index 92a8ce7..6f90971 100644
--- a/core/java/android/view/ViewGroup.java
+++ b/core/java/android/view/ViewGroup.java
@@ -2854,7 +2854,7 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager
// display lists to render, force an invalidate to allow the animation to
// continue drawing another frame
invalidate(true);
- if (a instanceof AlphaAnimation) {
+ if (a.hasAlpha()) {
// alpha animations should cause the child to recreate its display list
child.invalidate(true);
}
diff --git a/core/java/android/view/animation/AlphaAnimation.java b/core/java/android/view/animation/AlphaAnimation.java
index 651fe45..c4d9afc 100644
--- a/core/java/android/view/animation/AlphaAnimation.java
+++ b/core/java/android/view/animation/AlphaAnimation.java
@@ -78,4 +78,12 @@ public class AlphaAnimation extends Animation {
public boolean willChangeBounds() {
return false;
}
+
+ /**
+ * @hide
+ */
+ @Override
+ public boolean hasAlpha() {
+ return true;
+ }
}
diff --git a/core/java/android/view/animation/Animation.java b/core/java/android/view/animation/Animation.java
index 87c759c..b7dfabc 100644
--- a/core/java/android/view/animation/Animation.java
+++ b/core/java/android/view/animation/Animation.java
@@ -1001,6 +1001,15 @@ public abstract class Animation implements Cloneable {
}
/**
+ * Return true if this animation changes the view's alpha property.
+ *
+ * @hide
+ */
+ public boolean hasAlpha() {
+ return false;
+ }
+
+ /**
* Utility class to parse a string description of a size.
*/
protected static class Description {
diff --git a/core/java/android/view/animation/AnimationSet.java b/core/java/android/view/animation/AnimationSet.java
index 873ce53..5c0b3af 100644
--- a/core/java/android/view/animation/AnimationSet.java
+++ b/core/java/android/view/animation/AnimationSet.java
@@ -43,6 +43,8 @@ public class AnimationSet extends Animation {
private static final int PROPERTY_CHANGE_BOUNDS_MASK = 0x80;
private int mFlags = 0;
+ private boolean mDirty;
+ private boolean mHasAlpha;
private ArrayList<Animation> mAnimations = new ArrayList<Animation>();
@@ -137,6 +139,25 @@ public class AnimationSet extends Animation {
super.setStartOffset(startOffset);
}
+ @Override
+ public boolean hasAlpha() {
+ if (mDirty) {
+ mDirty = mHasAlpha = false;
+
+ final int count = mAnimations.size();
+ final ArrayList<Animation> animations = mAnimations;
+
+ for (int i = 0; i < count; i++) {
+ if (animations.get(i).hasAlpha()) {
+ mHasAlpha = true;
+ break;
+ }
+ }
+ }
+
+ return mHasAlpha;
+ }
+
/**
* <p>Sets the duration of every child animation.</p>
*
@@ -175,6 +196,8 @@ public class AnimationSet extends Animation {
mLastEnd = Math.max(mLastEnd, a.getStartOffset() + a.getDuration());
mDuration = mLastEnd - mStartOffset;
}
+
+ mDirty = true;
}
/**