summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorDeepanshu Gupta <deepanshu@google.com>2015-03-02 19:52:25 +0000
committerAndroid Git Automerger <android-git-automerger@android.com>2015-03-02 19:52:25 +0000
commitaff0ec93f2a734a68673f1f7337533b6d93cb256 (patch)
tree56e062c2d495a4fe682fcf74b65dcfee5fb54166 /tools
parent07d453fa091ab407864d474f9bf2a5167686010a (diff)
parent81449b2c4a63392bff22d77f331f4db52011884b (diff)
downloadframeworks_base-aff0ec93f2a734a68673f1f7337533b6d93cb256.zip
frameworks_base-aff0ec93f2a734a68673f1f7337533b6d93cb256.tar.gz
frameworks_base-aff0ec93f2a734a68673f1f7337533b6d93cb256.tar.bz2
am 81449b2c: am 10d620ff: Merge "Better error msg for StateList/Hexadecimal Color." into lmp-dev
* commit '81449b2c4a63392bff22d77f331f4db52011884b': 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;
}
}