Skip to content

Commit

Permalink
Fixed incorrect caption sizes after device orientation change.
Browse files Browse the repository at this point in the history
  • Loading branch information
ojw28 committed Jun 30, 2015
1 parent 35a9f26 commit ead8abf
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ public void setCues(List<Cue> cues) {
*/
public void setFontScale(float scale) {
fontScale = scale;
updateSubtitlesTextSize();
updateSubtitlesTextSize(getHeight());

for (SubtitleView subtitleView : subtitleViews) {
subtitleView.setTextSize(textSize);
Expand Down Expand Up @@ -125,7 +125,7 @@ protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
int height = MeasureSpec.getSize(heightMeasureSpec);
setMeasuredDimension(width, height);

updateSubtitlesTextSize();
updateSubtitlesTextSize(height);

for (int i = 0; i < viewsInUse; i++) {
subtitleViews.get(i).setTextSize(textSize);
Expand Down Expand Up @@ -175,8 +175,8 @@ protected void onLayout(boolean changed, int left, int top, int right, int botto
}
}

private void updateSubtitlesTextSize() {
textSize = LINE_HEIGHT_RATIO * getHeight() * fontScale;
private void updateSubtitlesTextSize(int height) {
textSize = LINE_HEIGHT_RATIO * height * fontScale;
}

private SubtitleView createSubtitleView() {
Expand Down

0 comments on commit ead8abf

Please sign in to comment.