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

Commit 73d27c3d authored by Michael Jurka's avatar Michael Jurka Committed by Android (Google) Code Review
Browse files

Merge "Check if View's alpha must be updated in setter"

parents 11d06a73 a7a7eede
Loading
Loading
Loading
Loading
+23 −17
Original line number Original line Diff line number Diff line
@@ -7597,6 +7597,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     */
     */
    public void setAlpha(float alpha) {
    public void setAlpha(float alpha) {
        ensureTransformationInfo();
        ensureTransformationInfo();
        if (mTransformationInfo.mAlpha != alpha) {
            mTransformationInfo.mAlpha = alpha;
            mTransformationInfo.mAlpha = alpha;
            invalidateParentCaches();
            invalidateParentCaches();
            if (onSetAlpha((int) (alpha * 255))) {
            if (onSetAlpha((int) (alpha * 255))) {
@@ -7608,6 +7609,7 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
                invalidate(false);
                invalidate(false);
            }
            }
        }
        }
    }
    /**
    /**
     * Faster version of setAlpha() which performs the same steps except there are
     * Faster version of setAlpha() which performs the same steps except there are
@@ -7616,18 +7618,22 @@ public class View implements Drawable.Callback, Drawable.Callback2, KeyEvent.Cal
     * alpha (the return value for onSetAlpha()).
     * alpha (the return value for onSetAlpha()).
     *
     *
     * @param alpha The new value for the alpha property
     * @param alpha The new value for the alpha property
     * @return true if the View subclass handles alpha (the return value for onSetAlpha())
     * @return true if the View subclass handles alpha (the return value for onSetAlpha()) and
     *         the new value for the alpha property is different from the old value
     */
     */
    boolean setAlphaNoInvalidation(float alpha) {
    boolean setAlphaNoInvalidation(float alpha) {
        ensureTransformationInfo();
        ensureTransformationInfo();
        if (mTransformationInfo.mAlpha != alpha) {
            mTransformationInfo.mAlpha = alpha;
            mTransformationInfo.mAlpha = alpha;
            boolean subclassHandlesAlpha = onSetAlpha((int) (alpha * 255));
            boolean subclassHandlesAlpha = onSetAlpha((int) (alpha * 255));
            if (subclassHandlesAlpha) {
            if (subclassHandlesAlpha) {
                mPrivateFlags |= ALPHA_SET;
                mPrivateFlags |= ALPHA_SET;
                return true;
            } else {
            } else {
                mPrivateFlags &= ~ALPHA_SET;
                mPrivateFlags &= ~ALPHA_SET;
            }
            }
        return subclassHandlesAlpha;
        }
        return false;
    }
    }
    /**
    /**