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

Commit d4745a68 authored by Romain Guy's avatar Romain Guy
Browse files

Nested alpha animations should cause invalidates too

Bug #5041061

Change-Id: I96835449b6b5537872afda90956c5d06d826e841
parent 9a8c5cef
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -2851,7 +2851,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;
    }
    
    /**