From da2b21472e8db0019c48977ab77b0acabd0502c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ryszard=20Wi=C5=9Bniewski?= Date: Tue, 23 Mar 2010 23:17:40 +0100 Subject: [PATCH] ResValueFactory: added ResIdValue recognition. --- .../androlib/res/data/value/ResValueFactory.java | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/brut/androlib/res/data/value/ResValueFactory.java b/src/brut/androlib/res/data/value/ResValueFactory.java index a4b80520..489e3e4a 100644 --- a/src/brut/androlib/res/data/value/ResValueFactory.java +++ b/src/brut/androlib/res/data/value/ResValueFactory.java @@ -65,7 +65,11 @@ public class ResValueFactory { throw new AndrolibException("Invalid value type: "+ type); } - public ResValue factory(JniEntry entry) + public ResValue factory(JniEntry entry) throws AndrolibException { + return factory(entry, false); + } + + private ResValue factory(JniEntry entry, boolean bagItem) throws AndrolibException { switch (entry.valueType) { case TYPE_BAG: @@ -75,6 +79,10 @@ public class ResValueFactory { case TypedValue.TYPE_ATTRIBUTE: return newReference(entry.intVal, true); case TypedValue.TYPE_INT_BOOLEAN: + if (! bagItem && ! "bool".equals(entry.type) + && ! entry.boolVal) { + return new ResIdValue(); + } return new ResBoolValue(entry.boolVal); case TypedValue.TYPE_INT_DEC: case TypedValue.TYPE_INT_HEX: @@ -137,7 +145,7 @@ public class ResValueFactory { for (int i = 0; i < jniItems.length; i++) { JniBagItem jniItem = jniItems[i]; items.put(newReference(jniItem.resID), - (ResScalarValue) factory(jniItem.entry)); + (ResScalarValue) factory(jniItem.entry, true)); } return items; }