Don't try to access the caption manager when in edit mode.

Issue: #1991

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=137131819
This commit is contained in:
andrewlewis 2016-07-21 02:08:21 +01:00 committed by Oliver Woodman
parent 99503e6e3a
commit ba6368a07a
2 changed files with 6 additions and 4 deletions

View file

@ -46,6 +46,7 @@ public abstract class TrackSelector<T> {
* @param trackSelections The new track selections.
*/
void onTrackSelectionsChanged(TrackSelections<? extends T> trackSelections);
}
private final Handler eventHandler;

View file

@ -122,10 +122,10 @@ public final class SubtitleView extends View implements TextRenderer.Output {
/**
* Sets the text size to one derived from {@link CaptioningManager#getFontScale()}, or to a
* default size on API level 19 and earlier.
* default size before API level 19.
*/
public void setUserDefaultTextSize() {
float fontScale = Util.SDK_INT >= 19 ? getUserCaptionFontScaleV19() : 1f;
float fontScale = Util.SDK_INT >= 19 && !isInEditMode() ? getUserCaptionFontScaleV19() : 1f;
setFractionalTextSize(DEFAULT_TEXT_SIZE_FRACTION * fontScale);
}
@ -180,10 +180,11 @@ public final class SubtitleView extends View implements TextRenderer.Output {
/**
* Sets the caption style to be equivalent to the one returned by
* {@link CaptioningManager#getUserStyle()}, or to a default style on API level 19 and earlier.
* {@link CaptioningManager#getUserStyle()}, or to a default style before API level 19.
*/
public void setUserDefaultStyle() {
setStyle(Util.SDK_INT >= 19 ? getUserCaptionStyleV19() : CaptionStyleCompat.DEFAULT);
setStyle(Util.SDK_INT >= 19 && !isInEditMode()
? getUserCaptionStyleV19() : CaptionStyleCompat.DEFAULT);
}
/**