diff options
author | Deepanshu Gupta <deepanshu@google.com> | 2014-08-09 14:14:45 -0700 |
---|---|---|
committer | Deepanshu Gupta <deepanshu@google.com> | 2014-08-26 00:26:56 +0000 |
commit | cc7ccc3fc1ea8e287a532b34d4d54ec97bf5aaa8 (patch) | |
tree | d49d69e6d290fc902a78c7b553a26cdda6c66455 /tools/layoutlib | |
parent | 17b94b8a583849c769aab57644e6c3c289b79e55 (diff) | |
download | frameworks_base-cc7ccc3fc1ea8e287a532b34d4d54ec97bf5aaa8.zip frameworks_base-cc7ccc3fc1ea8e287a532b34d4d54ec97bf5aaa8.tar.gz frameworks_base-cc7ccc3fc1ea8e287a532b34d4d54ec97bf5aaa8.tar.bz2 |
Resolve color xml attributes properly. [DO NOT MERGE]
Color attributes were not being converted to int properly. The
conversion to int was a simple string to int using base 16. This change
resolves the colors as per #RGB, #ARGB, #RRGGBB or #AARRGGBB format
depending on the length of the attribute. All values that begin with '#'
are treated as colors.
Bug: http://b.android.com/73845
Change-Id: I8ad089b821af1e290b9b95771b50213fe2fdd784
(cherry picked from commit 81564dfe60020fa977d39d168f682e9d61825660)
Diffstat (limited to 'tools/layoutlib')
-rw-r--r-- | tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java index 6ac5b02..691339e 100644 --- a/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java +++ b/tools/layoutlib/bridge/src/android/util/BridgeXmlPullAttributes.java @@ -22,6 +22,7 @@ import com.android.internal.util.XmlUtils; import com.android.layoutlib.bridge.Bridge; import com.android.layoutlib.bridge.BridgeConstants; import com.android.layoutlib.bridge.android.BridgeContext; +import com.android.layoutlib.bridge.impl.ResourceHelper; import com.android.resources.ResourceType; import org.xmlpull.v1.XmlPullParser; @@ -210,6 +211,9 @@ public class BridgeXmlPullAttributes extends XmlPullAttributes { value = r.getValue(); } + if (value.charAt(0) == '#') { + return ResourceHelper.getColor(value); + } return XmlUtils.convertValueToInt(value, defaultValue); } |