summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2010-10-08 17:59:13 -0700
committerAndroid Git Automerger <android-git-automerger@android.com>2010-10-08 17:59:13 -0700
commit79d433dd8772fb20caa947c2b0b20965348954a7 (patch)
tree94cac2e1d9cd8a32082c124c0fce9d7aea1e4669
parent1d8db8a0a83f3a09dd74afa3070df8bf4b8a6962 (diff)
parent556866a2ea1f4758a79fe4f207153b71815ed400 (diff)
downloadframeworks_base-79d433dd8772fb20caa947c2b0b20965348954a7.zip
frameworks_base-79d433dd8772fb20caa947c2b0b20965348954a7.tar.gz
frameworks_base-79d433dd8772fb20caa947c2b0b20965348954a7.tar.bz2
am 556866a2: am 656d2165: Merge "Parser is optional in obtainStyledAttributes." into gingerbread
Merge commit '556866a2ea1f4758a79fe4f207153b71815ed400' * commit '556866a2ea1f4758a79fe4f207153b71815ed400': Parser is optional in obtainStyledAttributes.
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java16
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java
index 58b1b6c..f501459 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/BridgeContext.java
@@ -246,8 +246,8 @@ public final class BridgeContext extends Context {
BridgeXmlBlockParser parser = null;
if (set instanceof BridgeXmlBlockParser) {
parser = (BridgeXmlBlockParser)set;
- } else {
- // reall this should not be happening since its instantiated in Bridge
+ } else if (set != null) { // null parser is ok
+ // really this should not be happening since its instantiated in Bridge
mLogger.error("Parser is not a BridgeXmlBlockParser!");
return null;
}
@@ -256,13 +256,16 @@ public final class BridgeContext extends Context {
TreeMap<Integer, String> styleNameMap = searchAttrs(attrs, frameworkAttributes);
BridgeTypedArray ta = ((BridgeResources) mResources).newTypeArray(attrs.length,
- parser.isPlatformFile());
+ parser != null ? parser.isPlatformFile() : true);
// resolve the defStyleAttr value into a IStyleResourceValue
IStyleResourceValue defStyleValues = null;
// look for a custom style.
- String customStyle = parser.getAttributeValue(null /* namespace*/, "style");
+ String customStyle = null;
+ if (parser != null) {
+ customStyle = parser.getAttributeValue(null /* namespace*/, "style");
+ }
if (customStyle != null) {
IResourceValue item = findResValue(customStyle);
@@ -309,7 +312,10 @@ public final class BridgeContext extends Context {
int index = styleAttribute.getKey().intValue();
String name = styleAttribute.getValue();
- String value = parser.getAttributeValue(namespace, name);
+ String value = null;
+ if (parser != null) {
+ value = parser.getAttributeValue(namespace, name);
+ }
// if there's no direct value for this attribute in the XML, we look for default
// values in the widget defStyle, and then in the theme.