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
8ac74a00
authored
Mar 03, 2021
by
Abel Jimenez
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
formatting
parent
ec69977a
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
13 additions
and
17 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/test/java/com/google/android/exoplayer2/text/ssa/SsaDecoderTest.java
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaDecoder.java
View file @
8ac74a00
...
@@ -324,22 +324,20 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
...
@@ -324,22 +324,20 @@ public final class SsaDecoder extends SimpleSubtitleDecoder {
if
(
style
.
bold
&&
style
.
italic
)
{
if
(
style
.
bold
&&
style
.
italic
)
{
spannableText
.
setSpan
(
spannableText
.
setSpan
(
new
StyleSpan
(
Typeface
.
BOLD_ITALIC
),
new
StyleSpan
(
Typeface
.
BOLD_ITALIC
),
0
,
/* start= */
0
,
spannableText
.
length
(),
/* end= */
spannableText
.
length
(),
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
}
}
else
if
(
style
.
bold
)
{
else
if
(
style
.
bold
){
spannableText
.
setSpan
(
spannableText
.
setSpan
(
new
StyleSpan
(
Typeface
.
BOLD
),
new
StyleSpan
(
Typeface
.
BOLD
),
0
,
/* start= */
0
,
spannableText
.
length
(),
/* end= */
spannableText
.
length
(),
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
}
}
else
if
(
style
.
italic
)
{
else
if
(
style
.
italic
){
spannableText
.
setSpan
(
spannableText
.
setSpan
(
new
StyleSpan
(
Typeface
.
ITALIC
),
new
StyleSpan
(
Typeface
.
ITALIC
),
0
,
/* start= */
0
,
spannableText
.
length
(),
/* end= */
spannableText
.
length
(),
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
SpannableString
.
SPAN_EXCLUSIVE_EXCLUSIVE
);
}
}
}
}
...
...
library/core/src/main/java/com/google/android/exoplayer2/text/ssa/SsaStyle.java
View file @
8ac74a00
...
@@ -218,10 +218,9 @@ import java.util.regex.Pattern;
...
@@ -218,10 +218,9 @@ import java.util.regex.Pattern;
private
static
boolean
parseBold
(
String
bold
)
{
private
static
boolean
parseBold
(
String
bold
)
{
try
{
try
{
int
boldFlag
=
Integer
.
parseInt
(
bold
);
int
boldFlag
=
Integer
.
parseInt
(
bold
);
if
(
boldFlag
==
1
||
boldFlag
==
-
1
)
{
if
(
boldFlag
==
1
||
boldFlag
==
-
1
)
{
return
true
;
return
true
;
}
}
else
{
else
{
return
false
;
return
false
;
}
}
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
...
@@ -233,10 +232,9 @@ import java.util.regex.Pattern;
...
@@ -233,10 +232,9 @@ import java.util.regex.Pattern;
private
static
boolean
parseItalic
(
String
italic
)
{
private
static
boolean
parseItalic
(
String
italic
)
{
try
{
try
{
int
italicFlag
=
Integer
.
parseInt
(
italic
);
int
italicFlag
=
Integer
.
parseInt
(
italic
);
if
(
italicFlag
==
1
||
italicFlag
==
-
1
)
{
if
(
italicFlag
==
1
||
italicFlag
==
-
1
)
{
return
true
;
return
true
;
}
}
else
{
else
{
return
false
;
return
false
;
}
}
}
catch
(
NumberFormatException
e
)
{
}
catch
(
NumberFormatException
e
)
{
...
...
library/core/src/test/java/com/google/android/exoplayer2/text/ssa/SsaDecoderTest.java
View file @
8ac74a00
...
@@ -338,7 +338,7 @@ public final class SsaDecoderTest {
...
@@ -338,7 +338,7 @@ public final class SsaDecoderTest {
}
}
@Test
@Test
public
void
decodeBoldItalic
()
throws
IOException
{
public
void
decodeBoldItalic
()
throws
IOException
{
SsaDecoder
decoder
=
new
SsaDecoder
();
SsaDecoder
decoder
=
new
SsaDecoder
();
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
STYLE_BOLD_ITALIC
);
byte
[]
bytes
=
TestUtil
.
getByteArray
(
ApplicationProvider
.
getApplicationContext
(),
STYLE_BOLD_ITALIC
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
Subtitle
subtitle
=
decoder
.
decode
(
bytes
,
bytes
.
length
,
false
);
...
...
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