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

Commit 6fa971ba authored by Nader Jawad's avatar Nader Jawad
Browse files

Updated ViewPropertyAnimator to call View

methods

Modified ViewPropertyAnimator to call directly
into View setters instead of RenderNode APIs to match
implementation of FloatProperty objects on View. This
makes the animation APIs consistent with one another
and always call through the proper code paths to
give View implementations an opportunity to handle
alpha changes themselves.

Bug: 140961174
Test: Added CTS tests for ViewPropertyAnimator
Change-Id: I1c0023af50be47786296b46510034eb798658c20
parent d4718e18
Loading
Loading
Loading
Loading
+18 −3
Original line number Diff line number Diff line
@@ -1138,6 +1138,12 @@ public class ViewPropertyAnimator {

            boolean hardwareAccelerated = mView.isHardwareAccelerated();

            // alpha requires slightly different treatment than the other (transform) properties.
            // The logic in setAlpha() is not simply setting mAlpha, plus the invalidation
            // logic is dependent on how the view handles an internal call to onSetAlpha().
            // We track what kinds of properties are set, and how alpha is handled when it is
            // set, and perform the invalidation steps appropriately.
            boolean alphaHandled = false;
            if (!hardwareAccelerated) {
                mView.invalidateParentCaches();
            }
@@ -1152,16 +1158,25 @@ public class ViewPropertyAnimator {
                for (int i = 0; i < count; ++i) {
                    NameValuesHolder values = valueList.get(i);
                    float value = values.mFromValue + fraction * values.mDeltaValue;
                    if (values.mNameConstant == ALPHA) {
                        alphaHandled = mView.setAlphaNoInvalidation(value);
                    } else {
                        setValue(values.mNameConstant, value);
                    }
                }
            }
            if ((propertyMask & TRANSFORM_MASK) != 0) {
                if (!hardwareAccelerated) {
                    mView.mPrivateFlags |= View.PFLAG_DRAWN; // force another invalidation
                }
            }

            // invalidate(false) in all cases except if alphaHandled gets set to true
            // via the call to setAlphaNoInvalidation(), above
            if (alphaHandled) {
                mView.invalidate(true);
            } else {
                mView.invalidateViewProperty(false, false);
            }
            if (mUpdateListener != null) {
                mUpdateListener.onAnimationUpdate(animation);
            }