Commit ba6368a0 by andrewlewis Committed by Oliver Woodman

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
parent 99503e6e
...@@ -46,6 +46,7 @@ public abstract class TrackSelector<T> { ...@@ -46,6 +46,7 @@ public abstract class TrackSelector<T> {
* @param trackSelections The new track selections. * @param trackSelections The new track selections.
*/ */
void onTrackSelectionsChanged(TrackSelections<? extends T> trackSelections); void onTrackSelectionsChanged(TrackSelections<? extends T> trackSelections);
} }
private final Handler eventHandler; private final Handler eventHandler;
......
...@@ -122,10 +122,10 @@ public final class SubtitleView extends View implements TextRenderer.Output { ...@@ -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 * 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() { 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); setFractionalTextSize(DEFAULT_TEXT_SIZE_FRACTION * fontScale);
} }
...@@ -180,10 +180,11 @@ public final class SubtitleView extends View implements TextRenderer.Output { ...@@ -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 * 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() { public void setUserDefaultStyle() {
setStyle(Util.SDK_INT >= 19 ? getUserCaptionStyleV19() : CaptionStyleCompat.DEFAULT); setStyle(Util.SDK_INT >= 19 && !isInEditMode()
? getUserCaptionStyleV19() : CaptionStyleCompat.DEFAULT);
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment