summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2015-03-02 20:03:28 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-02 20:03:28 +0000
commit4a194d3b7f3ea4aebc5a1a8f95ccaac248c1b89d (patch)
tree2a5c5d10efeb98b1cd92895354b8323739732a78 /tools
parentbf815f495270b466e53bec20772b41ff4397ac83 (diff)
parent6250030736e3ea25bacc92eba4c269dc6a6ee3db (diff)
downloadframeworks_base-4a194d3b7f3ea4aebc5a1a8f95ccaac248c1b89d.zip
frameworks_base-4a194d3b7f3ea4aebc5a1a8f95ccaac248c1b89d.tar.gz
frameworks_base-4a194d3b7f3ea4aebc5a1a8f95ccaac248c1b89d.tar.bz2
am 62500307: am aff0ec93: am 81449b2c: am 10d620ff: Merge "Better error msg for StateList/Hexadecimal Color." into lmp-dev
* commit '6250030736e3ea25bacc92eba4c269dc6a6ee3db': Better error msg for StateList/Hexadecimal Color.
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/android/content/res/BridgeResources.java16
1 files changed, 13 insertions, 3 deletions
diff --git a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
index 66126af..96ca250 100644
--- a/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
+++ b/tools/layoutlib/bridge/src/android/content/res/BridgeResources.java
@@ -178,11 +178,21 @@ public final class BridgeResources extends Resources {
Pair<String, ResourceValue> value = getResourceValue(id, mPlatformResourceFlag);
if (value != null) {
+ ResourceValue resourceValue = value.getSecond();
try {
- return ResourceHelper.getColor(value.getSecond().getValue());
+ return ResourceHelper.getColor(resourceValue.getValue());
} catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e,
- null /*data*/);
+ // Check if the value passed is a file. If it is, mostly likely, user is referencing
+ // a color state list from a place where they should reference only a pure color.
+ String message;
+ if (new File(resourceValue.getValue()).isFile()) {
+ String resource = (resourceValue.isFramework() ? "@android:" : "@") + "color/"
+ + resourceValue.getName();
+ message = "Hexadecimal color expected, found Color State List for " + resource;
+ } else {
+ message = e.getMessage();
+ }
+ Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, message, e, null);
return 0;
}
}