frameworks/base
修訂 | fffa6ad777d42c471746b3bba68b9bc3a24fc97a (tree) |
---|---|
時間 | 2011-06-09 09:12:42 |
作者 | Xavier Ducrohet <xav@andr...> |
Commiter | Xavier Ducrohet |
CherryPick 06942bc4 from hc-mr1. do not merge.
Layoutlib - use the new getParser callback when possible.
Change-Id: Ibfc056e5d1f414686a17f30571b173ecdc0936fd
@@ -296,12 +296,17 @@ public final class BridgeContext extends Activity { | ||
296 | 296 | |
297 | 297 | public Pair<View, Boolean> inflateView(ResourceReference resource, ViewGroup parent, |
298 | 298 | boolean attachToRoot, boolean skipCallbackParser) { |
299 | - String layoutName = resource.getName(); | |
300 | 299 | boolean isPlatformLayout = resource.isFramework(); |
301 | 300 | |
302 | 301 | if (isPlatformLayout == false && skipCallbackParser == false) { |
303 | 302 | // 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 | + | |
305 | 310 | if (parser != null) { |
306 | 311 | BridgeXmlBlockParser blockParser = new BridgeXmlBlockParser(parser, |
307 | 312 | this, resource.isFramework()); |
@@ -369,7 +374,7 @@ public final class BridgeContext extends Activity { | ||
369 | 374 | } else { |
370 | 375 | Bridge.getLog().error(LayoutLog.TAG_BROKEN, |
371 | 376 | String.format("Layout %s%s does not exist.", isPlatformLayout ? "android:" : "", |
372 | - layoutName), null); | |
377 | + resource.getName()), null); | |
373 | 378 | } |
374 | 379 | |
375 | 380 | return Pair.of(null, false); |
@@ -234,7 +234,7 @@ public final class BridgeResources extends Resources { | ||
234 | 234 | try { |
235 | 235 | // check if the current parser can provide us with a custom parser. |
236 | 236 | if (mPlatformResourceFlag[0] == false) { |
237 | - parser = mProjectCallback.getParser(value.getName()); | |
237 | + parser = mProjectCallback.getParser(value); | |
238 | 238 | } |
239 | 239 | |
240 | 240 | // create a new one manually if needed. |