summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2015-05-19 19:07:45 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-05-19 19:07:46 +0000
commit5deaa138443433f861a52f4cdc461a677437c416 (patch)
tree97b71591f86da7186ac5e318c6392d5c8bf1cc16 /tools
parent2d9c6015b32338f1b82f46ec7ea7328422f0330a (diff)
parent21b564573327b1ed2f7e06146b8a01c47ede3089 (diff)
downloadframeworks_base-5deaa138443433f861a52f4cdc461a677437c416.zip
frameworks_base-5deaa138443433f861a52f4cdc461a677437c416.tar.gz
frameworks_base-5deaa138443433f861a52f4cdc461a677437c416.tar.bz2
Merge "Fix include tag rendering." into mnc-dev
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java14
-rw-r--r--tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java3
2 files changed, 11 insertions, 6 deletions
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
index 572fdc9..771cf57 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeTypedArray.java
@@ -444,7 +444,7 @@ public final class BridgeTypedArray extends TypedArray {
@Override
public int getDimensionPixelSize(int index, int defValue) {
try {
- return getDimension(index);
+ return getDimension(index, null);
} catch (RuntimeException e) {
String s = getString(index);
@@ -474,12 +474,12 @@ public final class BridgeTypedArray extends TypedArray {
@Override
public int getLayoutDimension(int index, String name) {
try {
- // this will throw an exception
- return getDimension(index);
+ // this will throw an exception if not found.
+ return getDimension(index, name);
} catch (RuntimeException e) {
if (LayoutInflater_Delegate.sIsInInclude) {
- throw new RuntimeException();
+ throw new RuntimeException("Layout Dimension '" + name + "' not found.");
}
Bridge.getLog().warning(LayoutLog.TAG_RESOURCES_FORMAT,
@@ -494,9 +494,13 @@ public final class BridgeTypedArray extends TypedArray {
return getDimensionPixelSize(index, defValue);
}
- private int getDimension(int index) {
+ /** @param name attribute name, used for error reporting. */
+ private int getDimension(int index, @Nullable String name) {
String s = getString(index);
if (s == null) {
+ if (name != null) {
+ throw new RuntimeException("Attribute '" + name + "' not found");
+ }
throw new RuntimeException();
}
// Check if the value is a magic constant that doesn't require a unit.
diff --git a/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java b/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java
index 4072302..27b406a 100644
--- a/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java
+++ b/tools/layoutlib/bridge/src/android/view/LayoutInflater_Delegate.java
@@ -181,7 +181,8 @@ public class LayoutInflater_Delegate {
// ---- END CHANGES
params = group.generateLayoutParams(attrs);
-
+ } catch (RuntimeException ignored) {
+ // Ignore, just fail over to child attrs.
} finally {
// ---- START CHANGES
sIsInInclude = false;