Fixed
Status Update
Comments
dm...@gmail.com <dm...@gmail.com> #2
We use build flavours heavily with a lot of common code. The refactoring support in AS is really good but it continually catches us out when it doesn't work across all flavours in a project. It's a big gap for serious product development.
ar...@google.com <ar...@google.com>
ar...@google.com <ar...@google.com> #3
We at my company need this same feature. We have a lot of white labels and need refactor the same class across flavours. :(
[Deleted User] <[Deleted User]> #5
+1, I need this very badly
dm...@gmail.com <dm...@gmail.com> #6
+1 My company also need this feature.
Description
VectorDrawable starts to display its blurred (downscaled) version, if you are trying to draw it on both DisplayListCanvas and manually created software Canvas with scale factor applied.
I was able to decouple a code sample which triggers this bug, though I don't understand its real nature and what's happening internally in VectorDrawable.
Steps to reproduce:
1) Create a list of ImageViews. Set src attribute to use some vector image.
For example, I have used a regular RecyclerView populated with this kind of ImageViews.
2) Create a custom View with overridden draw() method (full View code is here
public void draw(Canvas canvas) {
super.draw(canvas);
if (canvas != softwareCanvas) {
softwareCanvas.save();
//scale is a main trigger here, VectorDrawable will be downscaled just as much as this canvas
softwareCanvas.scale(1f / 8, 1f / 8);
//draw all views on our canvas
root.draw(softwareCanvas);
softwareCanvas.restore();
invalidate();
}
}
3) Add this View to Activity with the list of ImageViews and pass a root of Activity to this View.
Result:
Despite the fact that I'm not drawing softwareCanvas' content anywhere, the images in list will become blurred, i.e. the state of VectorDrawable is getting mutated somehow by this softwareCanvas' scale factor.
What should happen:
VectorDrawable should be displayed correctly.
Note that VectorDrawableCompat, which is used on versions prior to SDK 24, works fine in this scenario.
A regular PNG image (BitmapDrawable) also has no issues.
Though the described flow looks kinda weird and complicated, it's a part of real use case in my BlurView library (
Here's the link to a small example project that demonstrates how to reproduce this bug: