From 162c1dcd5e635d17d8425936d7729d0ae5ed1a62 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Wed, 3 Aug 2011 17:20:58 -0700 Subject: Layoutlib: implement Resources.getBoolean(int). Change-Id: I44cee203bb9a8fabaebfd689fc20ec2f2a9b3561 --- .../bridge/src/android/content/res/BridgeResources.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) (limited to 'tools/layoutlib/bridge/src/android/content/res/BridgeResources.java') diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java index 625b40d..0928ec5 100644 --- a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java +++ b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java @@ -417,6 +417,22 @@ public final class BridgeResources extends Resources { } @Override + public boolean getBoolean(int id) throws NotFoundException { + Pair value = getResourceValue(id, mPlatformResourceFlag); + + if (value != null && value.getSecond().getValue() != null) { + String v = value.getSecond().getValue(); + return Boolean.parseBoolean(v); + } + + // id was not found or not resolved. Throw a NotFoundException. + throwException(id); + + // this is not used since the method above always throws + return false; + } + + @Override public String getResourceEntryName(int resid) throws NotFoundException { throw new UnsupportedOperationException(); } -- cgit v1.1