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
fbf75e12
authored
Feb 06, 2015
by
Oliver Woodman
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Fix SubtitleView to redraw if text changes but bounds stay the same.
parent
75059444
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
9 deletions
library/src/main/java/com/google/android/exoplayer/text/SubtitleView.java
library/src/main/java/com/google/android/exoplayer/text/SubtitleView.java
View file @
fbf75e12
...
@@ -123,7 +123,7 @@ public class SubtitleView extends View {
...
@@ -123,7 +123,7 @@ public class SubtitleView extends View {
@Override
@Override
public
void
setBackgroundColor
(
int
color
)
{
public
void
setBackgroundColor
(
int
color
)
{
backgroundColor
=
color
;
backgroundColor
=
color
;
invalidate
(
);
forceUpdate
(
false
);
}
}
/**
/**
...
@@ -134,8 +134,7 @@ public class SubtitleView extends View {
...
@@ -134,8 +134,7 @@ public class SubtitleView extends View {
public
void
setText
(
CharSequence
text
)
{
public
void
setText
(
CharSequence
text
)
{
textBuilder
.
setLength
(
0
);
textBuilder
.
setLength
(
0
);
textBuilder
.
append
(
text
);
textBuilder
.
append
(
text
);
hasMeasurements
=
false
;
forceUpdate
(
true
);
requestLayout
();
}
}
/**
/**
...
@@ -147,9 +146,7 @@ public class SubtitleView extends View {
...
@@ -147,9 +146,7 @@ public class SubtitleView extends View {
if
(
textPaint
.
getTextSize
()
!=
size
)
{
if
(
textPaint
.
getTextSize
()
!=
size
)
{
textPaint
.
setTextSize
(
size
);
textPaint
.
setTextSize
(
size
);
innerPaddingX
=
(
int
)
(
size
*
INNER_PADDING_RATIO
+
0.5f
);
innerPaddingX
=
(
int
)
(
size
*
INNER_PADDING_RATIO
+
0.5f
);
hasMeasurements
=
false
;
forceUpdate
(
true
);
requestLayout
();
invalidate
();
}
}
}
}
...
@@ -165,17 +162,22 @@ public class SubtitleView extends View {
...
@@ -165,17 +162,22 @@ public class SubtitleView extends View {
edgeColor
=
style
.
edgeColor
;
edgeColor
=
style
.
edgeColor
;
setTypeface
(
style
.
typeface
);
setTypeface
(
style
.
typeface
);
super
.
setBackgroundColor
(
style
.
windowColor
);
super
.
setBackgroundColor
(
style
.
windowColor
);
hasMeasurements
=
false
;
forceUpdate
(
true
);
requestLayout
();
}
}
private
void
setTypeface
(
Typeface
typeface
)
{
private
void
setTypeface
(
Typeface
typeface
)
{
if
(
textPaint
.
getTypeface
()
!=
typeface
)
{
if
(
textPaint
.
getTypeface
()
!=
typeface
)
{
textPaint
.
setTypeface
(
typeface
);
textPaint
.
setTypeface
(
typeface
);
forceUpdate
(
true
);
}
}
private
void
forceUpdate
(
boolean
needsLayout
)
{
if
(
needsLayout
)
{
hasMeasurements
=
false
;
hasMeasurements
=
false
;
requestLayout
();
requestLayout
();
invalidate
();
}
}
invalidate
();
}
}
@Override
@Override
...
...
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