From 45f207d6d9ccec1b9975f2ec4ca55e3c42f7bc48 Mon Sep 17 00:00:00 2001 From: Alan Viverette Date: Thu, 9 Apr 2015 13:14:32 -0700 Subject: Only parse LayerDrawable child items when necessary Bug: 20098214 Change-Id: Ie9da5f6e494ede47f9fdc94481a3f8ca41d3ef00 --- graphics/java/android/graphics/drawable/LayerDrawable.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'graphics') diff --git a/graphics/java/android/graphics/drawable/LayerDrawable.java b/graphics/java/android/graphics/drawable/LayerDrawable.java index a2f71e5..78eee37 100644 --- a/graphics/java/android/graphics/drawable/LayerDrawable.java +++ b/graphics/java/android/graphics/drawable/LayerDrawable.java @@ -211,7 +211,11 @@ public class LayerDrawable extends Drawable implements Drawable.Callback { updateLayerFromTypedArray(layer, a); a.recycle(); - if (layer.mDrawable == null) { + // If the layer doesn't have a drawable or unresolved theme + // attribute for a drawable, attempt to parse one from the child + // element. + if (layer.mDrawable == null && (layer.mThemeAttrs == null || + layer.mThemeAttrs[R.styleable.LayerDrawableItem_drawable] == 0)) { while ((type = parser.next()) == XmlPullParser.TEXT) { } if (type != XmlPullParser.START_TAG) { -- cgit v1.1