summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-06-07 17:48:35 -0700
committerXavier Ducrohet <xav@android.com>2011-06-16 18:26:25 -0700
commitd6465e10c27140647e02be8160d900d6e7e78441 (patch)
tree9d1d07ec308956d7329535b57d89fb7c46117567
parent6b62c82848b9823a26fc107deef8227d9cd516a6 (diff)
downloadframeworks_base-d6465e10c27140647e02be8160d900d6e7e78441.zip
frameworks_base-d6465e10c27140647e02be8160d900d6e7e78441.tar.gz
frameworks_base-d6465e10c27140647e02be8160d900d6e7e78441.tar.bz2
CherryPick 06942bc4 from hc-mr1. do not merge.
Layoutlib - use the new getParser callback when possible. Change-Id: I72b867aa573fcc07d610f139da3c90b1b654633c
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java11
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java2
2 files changed, 9 insertions, 4 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
index 7e13bb1..904f7a3 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java
@@ -296,12 +296,17 @@ public final class BridgeContext extends Activity {
public Pair<View, Boolean> inflateView(ResourceReference resource, ViewGroup parent,
boolean attachToRoot, boolean skipCallbackParser) {
- String layoutName = resource.getName();
boolean isPlatformLayout = resource.isFramework();
if (isPlatformLayout == false && skipCallbackParser == false) {
// check if the project callback can provide us with a custom parser.
- ILayoutPullParser parser = mProjectCallback.getParser(layoutName);
+ ILayoutPullParser parser;
+ if (resource instanceof ResourceValue) {
+ parser = mProjectCallback.getParser((ResourceValue) resource);
+ } else {
+ parser = mProjectCallback.getParser(resource.getName());
+ }
+
if (parser != null) {
BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(parser,
this, resource.isFramework());
@@ -369,7 +374,7 @@ public final class BridgeContext extends Activity {
} else {
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
String.format("Layout %s%s does not exist.", isPlatformLayout ? "android:" : "",
- layoutName), null);
+ resource.getName()), null);
}
return Pair.of(null, false);
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
index ca44f6e..d0b90fb 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java
@@ -234,7 +234,7 @@ public final class BridgeResources extends Resources {
try {
// check if the current parser can provide us with a custom parser.
if (mPlatformResourceFlag[0] == false) {
- parser = mProjectCallback.getParser(value.getName());
+ parser = mProjectCallback.getParser(value);
}
// create a new one manually if needed.