summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorXavier Ducrohet <xav@android.com>2011-02-06 21:05:21 -0800
committerXavier Ducrohet <xav@android.com>2011-02-06 21:05:21 -0800
commitd96a7403cda1a873e640b6e6395ddab4c2f9b9f9 (patch)
tree10fadb724cabbed4c9b36c02412d1cd85c4be4a3 /tools
parentb0d34f9c99cbd43e8238c5952b19d032f02dd168 (diff)
downloadframeworks_base-d96a7403cda1a873e640b6e6395ddab4c2f9b9f9.zip
frameworks_base-d96a7403cda1a873e640b6e6395ddab4c2f9b9f9.tar.gz
frameworks_base-d96a7403cda1a873e640b6e6395ddab4c2f9b9f9.tar.bz2
LayoutLib: Handle color state list in methods returning an int.
Change-Id: Ia35ea09b992a239873026c7ef1629a01dd2e6cec
Diffstat (limited to 'tools')
-rw-r--r--tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java11
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
index c226b8b..15c4f44 100644
--- a/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
+++ b/tools/layoutlib/bridge/src/com/android/layoutlib/bridge/android/BridgeTypedArray.java
@@ -270,13 +270,10 @@ public final class BridgeTypedArray extends TypedArray {
return defValue;
}
- String s = mResourceData[index].getValue();
- try {
- return ResourceHelper.getColor(s);
- } catch (NumberFormatException e) {
- Bridge.getLog().error(LayoutLog.TAG_RESOURCES_FORMAT, e.getMessage(), e, null /*data*/);
-
- // we'll return the default value below.
+ ColorStateList colorStateList = ResourceHelper.getColorStateList(
+ mResourceData[index], mContext);
+ if (colorStateList != null) {
+ return colorStateList.getDefaultColor();
}
return defValue;