diff options
author | Alan Viverette <alanv@google.com> | 2014-11-21 20:40:08 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-11-21 20:40:08 +0000 |
commit | 47172f53659e4e98988dab99a4155653b638b1e5 (patch) | |
tree | 36e560fd7bfacb198b76fa70e5faa412495929ae | |
parent | 2c596a533488320444e28bbe37b7032589a0c5dd (diff) | |
parent | a987d9af69ca5447a888a3d5b50f3511d4b8f0da (diff) | |
download | frameworks_base-47172f53659e4e98988dab99a4155653b638b1e5.zip frameworks_base-47172f53659e4e98988dab99a4155653b638b1e5.tar.gz frameworks_base-47172f53659e4e98988dab99a4155653b638b1e5.tar.bz2 |
Merge "Use parseColor instead of getHTMLColor"
-rw-r--r-- | core/java/android/content/res/StringBlock.java | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/core/java/android/content/res/StringBlock.java b/core/java/android/content/res/StringBlock.java index 77b8a33..9652db7 100644 --- a/core/java/android/content/res/StringBlock.java +++ b/core/java/android/content/res/StringBlock.java @@ -311,13 +311,13 @@ final class StringBlock { * the color black is returned instead. * * @param color The color as a string. Can be a resource reference, - * HTML hexadecimal, octal or a name + * hexadecimal, octal or a name * @param foreground True if the color will be used as the foreground color, * false otherwise * * @return A CharacterStyle * - * @see Color#getHtmlColor(String) + * @see Color#parseColor(String) */ private static CharacterStyle getColor(String color, boolean foreground) { int c = 0xff000000; @@ -336,7 +336,11 @@ final class StringBlock { } } } else { - c = Color.getHtmlColor(color); + try { + c = Color.parseColor(color); + } catch (IllegalArgumentException e) { + c = Color.BLACK; + } } } |