From 916e8723305521f562243bc87fef3431b61366cf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryszard=20Wi=C5=9Bniewski?= Date: Fri, 2 Apr 2010 14:20:20 +0200 Subject: [PATCH] Marking items of enum and flags attrs as synthesized. --- src/brut/androlib/res/data/value/ResAttr.java | 9 ++++++--- src/brut/androlib/res/data/value/ResValueFactory.java | 2 +- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/src/brut/androlib/res/data/value/ResAttr.java b/src/brut/androlib/res/data/value/ResAttr.java index 1d9edf1d..b1becbd5 100644 --- a/src/brut/androlib/res/data/value/ResAttr.java +++ b/src/brut/androlib/res/data/value/ResAttr.java @@ -18,6 +18,7 @@ package brut.androlib.res.data.value; import brut.androlib.AndrolibException; +import brut.androlib.res.data.ResPackage; import brut.androlib.res.data.ResResource; import brut.util.Duo; import java.io.IOException; @@ -66,8 +67,8 @@ public class ResAttr extends ResBagValue implements ResXmlSerializable { public static ResAttr factory(ResReferenceValue parent, - Duo[] items, ResValueFactory factory) - throws AndrolibException { + Duo[] items, ResValueFactory factory, + ResPackage pkg) throws AndrolibException { int type = ((ResIntValue) items[0].m2).getValue(); int scalarType = type & 0xffff; @@ -96,8 +97,10 @@ public class ResAttr extends ResBagValue implements ResXmlSerializable { new Duo[items.length - i]; int j = 0; for (; i < items.length; i++) { + int resId = items[i].m1; + pkg.addSynthesizedRes(resId); attrItems[j++] = new Duo( - factory.newReference(items[i].m1), (ResIntValue) items[i].m2); + factory.newReference(resId), (ResIntValue) items[i].m2); } switch (type & 0xff0000) { case TYPE_ENUM: diff --git a/src/brut/androlib/res/data/value/ResValueFactory.java b/src/brut/androlib/res/data/value/ResValueFactory.java index 95822685..520f1fd4 100644 --- a/src/brut/androlib/res/data/value/ResValueFactory.java +++ b/src/brut/androlib/res/data/value/ResValueFactory.java @@ -77,7 +77,7 @@ public class ResValueFactory { } int key = items[0].m1; if (key == ResAttr.BAG_KEY_ATTR_TYPE) { - return ResAttr.factory(parentVal, items, this); + return ResAttr.factory(parentVal, items, this, mPackage); } if (key == ResArrayValue.BAG_KEY_ARRAY_START) { return new ResArrayValue(parentVal, items);