Skip to content

Commit 4753498

Browse files
Xavier DucrohetAndroid (Google) Code Review
authored andcommitted
Merge "CherryPick 06942bc4 from hc-mr1. do not merge." into gingerbread
2 parents 9918ffb + d6465e1 commit 4753498

2 files changed

Lines changed: 9 additions & 4 deletions

File tree

tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeContext.java

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -296,12 +296,17 @@ public ResourceReference resolveId(int id) {
296296

297297
public Pair<View, Boolean> inflateView(ResourceReference resource, ViewGroup parent,
298298
boolean attachToRoot, boolean skipCallbackParser) {
299-
String layoutName = resource.getName();
300299
boolean isPlatformLayout = resource.isFramework();
301300

302301
if (isPlatformLayout == false && skipCallbackParser == false) {
303302
// check if the project callback can provide us with a custom parser.
304-
ILayoutPullParser parser = mProjectCallback.getParser(layoutName);
303+
ILayoutPullParser parser;
304+
if (resource instanceof ResourceValue) {
305+
parser = mProjectCallback.getParser((ResourceValue) resource);
306+
} else {
307+
parser = mProjectCallback.getParser(resource.getName());
308+
}
309+
305310
if (parser != null) {
306311
BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(parser,
307312
this, resource.isFramework());
@@ -369,7 +374,7 @@ public Pair<View, Boolean> inflateView(ResourceReference resource, ViewGroup par
369374
} else {
370375
Bridge.getLog().error(LayoutLog.TAG_BROKEN,
371376
String.format("Layout %s%s does not exist.", isPlatformLayout ? "android:" : "",
372-
layoutName), null);
377+
resource.getName()), null);
373378
}
374379

375380
return Pair.of(null, false);

tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeResources.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ public XmlResourceParser getLayout(int id) throws NotFoundException {
234234
try {
235235
// check if the current parser can provide us with a custom parser.
236236
if (mPlatformResourceFlag[0] == false) {
237-
parser = mProjectCallback.getParser(value.getName());
237+
parser = mProjectCallback.getParser(value);
238238
}
239239

240240
// create a new one manually if needed.

0 commit comments

Comments
 (0)