Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5bae58df authored by Romain Guy's avatar Romain Guy Committed by Android (Google) Code Review
Browse files

Merge "Nested alpha animations should cause invalidates too Bug #5041061"

parents 556d0476 d4745a68
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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);
            }
+8 −0
Original line number Diff line number Diff line
@@ -78,4 +78,12 @@ public class AlphaAnimation extends Animation {
    public boolean willChangeBounds() {
        return false;
    }

    /**
     * @hide
     */
    @Override
    public boolean hasAlpha() {
        return true;
    }
}
+9 −0
Original line number Diff line number Diff line
@@ -1000,6 +1000,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.
     */
+23 −0
Original line number Diff line number Diff line
@@ -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;
    }
    
    /**