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
b83041a6
authored
Mar 10, 2020
by
olly
Committed by
Oliver Woodman
Mar 11, 2020
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix SubtitleView.ViewType IntDef
PiperOrigin-RevId: 300067502
parent
a5f0eb1e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
10 deletions
library/ui/src/main/java/com/google/android/exoplayer2/ui/SubtitleView.java
library/ui/src/main/java/com/google/android/exoplayer2/ui/SubtitleView.java
View file @
b83041a6
...
...
@@ -80,9 +80,9 @@ public final class SubtitleView extends ViewGroup implements TextOutput {
* <li>{@link #VIEW_TYPE_WEB}
* </ul>
*/
@IntDef
@Documented
@Retention
(
SOURCE
)
@IntDef
({
VIEW_TYPE_TEXT
,
VIEW_TYPE_WEB
})
public
@interface
ViewType
{}
private
@ViewType
int
viewType
;
...
...
@@ -128,19 +128,24 @@ public final class SubtitleView extends ViewGroup implements TextOutput {
*
* <p>NOTE: {@link #VIEW_TYPE_WEB} is currently very experimental, and doesn't support most
* styling and layout properties of {@link Cue}.
*
* @param viewType The {@link ViewType} to use.
*/
public
void
setViewType
(
@ViewType
int
newV
iewType
)
{
if
(
viewType
==
newV
iewType
)
{
public
void
setViewType
(
@ViewType
int
v
iewType
)
{
if
(
this
.
viewType
==
v
iewType
)
{
return
;
}
if
(
newViewType
==
VIEW_TYPE_TEXT
)
{
setView
(
new
SubtitleTextView
(
getContext
()));
}
else
if
(
newViewType
==
VIEW_TYPE_WEB
)
{
setView
(
new
SubtitleWebView
(
getContext
()));
}
else
{
throw
new
IllegalArgumentException
();
switch
(
viewType
)
{
case
VIEW_TYPE_TEXT:
setView
(
new
SubtitleTextView
(
getContext
()));
break
;
case
VIEW_TYPE_WEB:
setView
(
new
SubtitleWebView
(
getContext
()));
break
;
default
:
throw
new
IllegalArgumentException
();
}
viewType
=
newV
iewType
;
this
.
viewType
=
v
iewType
;
}
private
<
T
extends
View
&
Output
>
void
setView
(
T
view
)
{
...
...
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