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
f8a47bc8
authored
Jan 26, 2021
by
Arnold Szabo
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Modify the SsaColor to be more similar to the Optional class.
parent
22413205
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
7 deletions
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaDecoder.java
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaStyle.java
library/core/src/main/java/com/google/android/exoplayer2/util/ColorParser.java
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaDecoder.java
View file @
f8a47bc8
...
@@ -308,8 +308,8 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
...
@@ -308,8 +308,8 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
// Apply primary color.
// Apply primary color.
if
(
style
!=
null
)
{
if
(
style
!=
null
)
{
if
(
style
.
primaryColor
.
isSet
)
{
if
(
style
.
primaryColor
.
isSet
()
)
{
spannableText
.
setSpan
(
new
ForegroundColorSpan
(
style
.
primaryColor
.
value
),
spannableText
.
setSpan
(
new
ForegroundColorSpan
(
style
.
primaryColor
.
getColor
()
),
0
,
spannableText
.
length
(),
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
0
,
spannableText
.
length
(),
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
}
}
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaStyle.java
View file @
f8a47bc8
...
@@ -31,6 +31,7 @@ import com.google.android.exoplayer2.util.Log;
...
@@ -31,6 +31,7 @@ import com.google.android.exoplayer2.util.Log;
import
com.google.android.exoplayer2.util.Util
;
import
com.google.android.exoplayer2.util.Util
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Documented
;
import
java.lang.annotation.Retention
;
import
java.lang.annotation.Retention
;
import
java.util.NoSuchElementException
;
import
java.util.regex.Matcher
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
import
java.util.regex.Pattern
;
...
@@ -166,14 +167,25 @@ import java.util.regex.Pattern;
...
@@ -166,14 +167,25 @@ import java.util.regex.Pattern;
public
static
SsaColor
UNSET
=
new
SsaColor
(
0
,
false
);
public
static
SsaColor
UNSET
=
new
SsaColor
(
0
,
false
);
p
ublic
final
@ColorInt
int
value
;
p
rivate
final
@ColorInt
int
color
;
p
ublic
final
boolean
isSet
;
p
rivate
final
boolean
isSet
;
private
SsaColor
(
@ColorInt
int
value
,
boolean
isSet
)
{
private
SsaColor
(
@ColorInt
int
color
,
boolean
isSet
)
{
this
.
value
=
value
;
this
.
color
=
color
;
this
.
isSet
=
isSet
;
this
.
isSet
=
isSet
;
}
}
public
@ColorInt
int
getColor
()
{
if
(!
isSet
)
{
throw
new
NoSuchElementException
(
"No color is present"
);
}
return
color
;
}
public
boolean
isSet
()
{
return
isSet
;
}
public
static
SsaColor
from
(
@ColorInt
int
value
)
{
public
static
SsaColor
from
(
@ColorInt
int
value
)
{
return
new
SsaColor
(
value
,
true
);
return
new
SsaColor
(
value
,
true
);
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/util/ColorParser.java
View file @
f8a47bc8
...
@@ -90,7 +90,7 @@ public final class ColorParser {
...
@@ -90,7 +90,7 @@ public final class ColorParser {
rgbaStringBuilder
.
insert
(
2
,
"0"
);
rgbaStringBuilder
.
insert
(
2
,
"0"
);
}
}
}
}
abgr
=
(
int
)
Long
.
parseLong
(
colorExpression
.
substring
(
2
),
16
);
abgr
=
(
int
)
Long
.
parseLong
(
rgbaStringBuilder
.
substring
(
2
),
16
);
}
else
{
}
else
{
// Parse color from decimal format (bytes order AABBGGRR).
// Parse color from decimal format (bytes order AABBGGRR).
abgr
=
(
int
)
Long
.
parseLong
(
colorExpression
);
abgr
=
(
int
)
Long
.
parseLong
(
colorExpression
);
...
...
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