diff options
| author | 2014-11-21 20:45:09 +0000 | |
|---|---|---|
| committer | 2014-11-21 20:45:09 +0000 | |
| commit | e442e904ae19f0b59ebfd4a7c735648b64bc955e (patch) | |
| tree | 36e560fd7bfacb198b76fa70e5faa412495929ae | |
| parent | 3fc5e3cabfd9787e722b7720eabbcbba49984a94 (diff) | |
| parent | 47172f53659e4e98988dab99a4155653b638b1e5 (diff) | |
am 47172f53: Merge "Use parseColor instead of getHTMLColor"
* commit '47172f53659e4e98988dab99a4155653b638b1e5':
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 77b8a3314148..9652db73e0ed 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; + } } } |