Marking items of enum and flags attrs as synthesized.

This commit is contained in:
Ryszard Wiśniewski 2010-04-02 14:20:20 +02:00
parent e9db0b3426
commit 916e872330
2 changed files with 7 additions and 4 deletions

View File

@ -18,6 +18,7 @@
package brut.androlib.res.data.value; package brut.androlib.res.data.value;
import brut.androlib.AndrolibException; import brut.androlib.AndrolibException;
import brut.androlib.res.data.ResPackage;
import brut.androlib.res.data.ResResource; import brut.androlib.res.data.ResResource;
import brut.util.Duo; import brut.util.Duo;
import java.io.IOException; import java.io.IOException;
@ -66,8 +67,8 @@ public class ResAttr extends ResBagValue implements ResXmlSerializable {
public static ResAttr factory(ResReferenceValue parent, public static ResAttr factory(ResReferenceValue parent,
Duo<Integer, ResScalarValue>[] items, ResValueFactory factory) Duo<Integer, ResScalarValue>[] items, ResValueFactory factory,
throws AndrolibException { ResPackage pkg) throws AndrolibException {
int type = ((ResIntValue) items[0].m2).getValue(); int type = ((ResIntValue) items[0].m2).getValue();
int scalarType = type & 0xffff; int scalarType = type & 0xffff;
@ -96,8 +97,10 @@ public class ResAttr extends ResBagValue implements ResXmlSerializable {
new Duo[items.length - i]; new Duo[items.length - i];
int j = 0; int j = 0;
for (; i < items.length; i++) { for (; i < items.length; i++) {
int resId = items[i].m1;
pkg.addSynthesizedRes(resId);
attrItems[j++] = new Duo<ResReferenceValue, ResIntValue>( attrItems[j++] = new Duo<ResReferenceValue, ResIntValue>(
factory.newReference(items[i].m1), (ResIntValue) items[i].m2); factory.newReference(resId), (ResIntValue) items[i].m2);
} }
switch (type & 0xff0000) { switch (type & 0xff0000) {
case TYPE_ENUM: case TYPE_ENUM:

View File

@ -77,7 +77,7 @@ public class ResValueFactory {
} }
int key = items[0].m1; int key = items[0].m1;
if (key == ResAttr.BAG_KEY_ATTR_TYPE) { 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) { if (key == ResArrayValue.BAG_KEY_ARRAY_START) {
return new ResArrayValue(parentVal, items); return new ResArrayValue(parentVal, items);