Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
c60dac7c
authored
Jan 15, 2016
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Further tweaks to TTML color parsing.
parent
7974a614
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlColorParser.java
library/src/main/java/com/google/android/exoplayer/text/ttml/TtmlColorParser.java
View file @
c60dac7c
...
...
@@ -88,18 +88,18 @@ import java.util.regex.Pattern;
Assertions
.
checkArgument
(!
TextUtils
.
isEmpty
(
colorExpression
));
colorExpression
=
colorExpression
.
replace
(
" "
,
""
);
if
(
colorExpression
.
charAt
(
0
)
==
'#'
)
{
//
Use a long to avoid rollovers on #FFXXXXXX
long
color
=
Long
.
parseLong
(
colorExpression
.
substring
(
1
),
16
);
//
Parse using Long to avoid failure when the unsigned value exceeds (2^31 - 1).
int
color
=
(
int
)
Long
.
parseLong
(
colorExpression
.
substring
(
1
),
16
);
if
(
colorExpression
.
length
()
==
7
)
{
// Set the alpha value
color
|=
0xFF000000
L
;
color
|=
0xFF000000
;
}
else
if
(
colorExpression
.
length
()
==
9
)
{
// We have #RRGGBBAA, but we need #AARRGGBB
color
=
((
color
&
0xFF
)
<<
24
)
|
(
color
>>
8
);
color
=
((
color
&
0xFF
)
<<
24
)
|
(
color
>>
>
8
);
}
else
{
throw
new
IllegalArgumentException
();
}
return
(
int
)
color
;
return
color
;
}
else
if
(
colorExpression
.
startsWith
(
RGBA
))
{
Matcher
matcher
=
RGBA_PATTERN
.
matcher
(
colorExpression
);
if
(
matcher
.
matches
())
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment