summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Snild Dolkow <snild.dolkow@sonymobile.com> 2015-09-04 10:08:05 +0200
committer Zoran Jovanovic <zoran.jovanovic@sonymobile.com> 2015-09-04 10:08:46 +0200
commita72f59a858ebda3d96583502d8ac02443d6223c3 (patch)
tree25fbb0ebd0f2f3cae8ed04e9b63f5cad028c1895
parent53f1a815b4401f10cd833217143da44ab0408dcc (diff)
Update mFillPaint color on GradientDrawable inflation
When a GradientDrawable is loaded from scratch, initializeWithState() is called with mColors == null. This sets mFillPaint's color to 0x00000000 -- transparent. mColors is then properly set in inflate(), but mFillPaint is not updated there. It will be updated eventually through a mutate() or ensureValidRect() call, but that's sometimes too late. In our case, a wrapping StateListDrawable called getOpacity(), and since it caches the result, it never got updated. This doesn't cause any problems on preloaded GradientDrawables, since the new GradientDrawable created when fetching a preload will call initializeWithState() in its constructor, fixing the GradientState. Change-Id: Ic8caa7c6a7c1d4dae5ff31ae943831bd2e014f79
-rw-r--r--graphics/java/android/graphics/drawable/GradientDrawable.java1
1 files changed, 1 insertions, 0 deletions
diff --git a/graphics/java/android/graphics/drawable/GradientDrawable.java b/graphics/java/android/graphics/drawable/GradientDrawable.java
index 72707e699a14..e097b57989e1 100644
--- a/graphics/java/android/graphics/drawable/GradientDrawable.java
+++ b/graphics/java/android/graphics/drawable/GradientDrawable.java
@@ -1019,6 +1019,7 @@ public class GradientDrawable extends Drawable {
inflateChildElements(r, parser, attrs, theme);
mGradientState.computeOpacity();
+ initializeWithState(mGradientState);
}
@Override