@@ -7597,15 +7597,17 @@ public float getAlpha() {
75977597 */
75987598 public void setAlpha(float alpha) {
75997599 ensureTransformationInfo();
7600- mTransformationInfo.mAlpha = alpha;
7601- invalidateParentCaches();
7602- if (onSetAlpha((int) (alpha * 255))) {
7603- mPrivateFlags |= ALPHA_SET;
7604- // subclass is handling alpha - don't optimize rendering cache invalidation
7605- invalidate(true);
7606- } else {
7607- mPrivateFlags &= ~ALPHA_SET;
7608- invalidate(false);
7600+ if (mTransformationInfo.mAlpha != alpha) {
7601+ mTransformationInfo.mAlpha = alpha;
7602+ invalidateParentCaches();
7603+ if (onSetAlpha((int) (alpha * 255))) {
7604+ mPrivateFlags |= ALPHA_SET;
7605+ // subclass is handling alpha - don't optimize rendering cache invalidation
7606+ invalidate(true);
7607+ } else {
7608+ mPrivateFlags &= ~ALPHA_SET;
7609+ invalidate(false);
7610+ }
76097611 }
76107612 }
76117613
@@ -7616,18 +7618,22 @@ public void setAlpha(float alpha) {
76167618 * alpha (the return value for onSetAlpha()).
76177619 *
76187620 * @param alpha The new value for the alpha property
7619- * @return true if the View subclass handles alpha (the return value for onSetAlpha())
7621+ * @return true if the View subclass handles alpha (the return value for onSetAlpha()) and
7622+ * the new value for the alpha property is different from the old value
76207623 */
76217624 boolean setAlphaNoInvalidation(float alpha) {
76227625 ensureTransformationInfo();
7623- mTransformationInfo.mAlpha = alpha;
7624- boolean subclassHandlesAlpha = onSetAlpha((int) (alpha * 255));
7625- if (subclassHandlesAlpha) {
7626- mPrivateFlags |= ALPHA_SET;
7627- } else {
7628- mPrivateFlags &= ~ALPHA_SET;
7626+ if (mTransformationInfo.mAlpha != alpha) {
7627+ mTransformationInfo.mAlpha = alpha;
7628+ boolean subclassHandlesAlpha = onSetAlpha((int) (alpha * 255));
7629+ if (subclassHandlesAlpha) {
7630+ mPrivateFlags |= ALPHA_SET;
7631+ return true;
7632+ } else {
7633+ mPrivateFlags &= ~ALPHA_SET;
7634+ }
76297635 }
7630- return subclassHandlesAlpha ;
7636+ return false ;
76317637 }
76327638
76337639 /**
0 commit comments