From ba6368a07a36109fc3fa027705e6ab40258f8144 Mon Sep 17 00:00:00 2001 From: andrewlewis Date: Thu, 21 Jul 2016 02:08:21 +0100 Subject: [PATCH] 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 --- .../android/exoplayer2/trackselection/TrackSelector.java | 1 + .../com/google/android/exoplayer2/ui/SubtitleView.java | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/library/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java b/library/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java index 41c62f6e0e..9c859312cb 100644 --- a/library/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java +++ b/library/src/main/java/com/google/android/exoplayer2/trackselection/TrackSelector.java @@ -46,6 +46,7 @@ public abstract class TrackSelector { * @param trackSelections The new track selections. */ void onTrackSelectionsChanged(TrackSelections trackSelections); + } private final Handler eventHandler; diff --git a/library/src/main/java/com/google/android/exoplayer2/ui/SubtitleView.java b/library/src/main/java/com/google/android/exoplayer2/ui/SubtitleView.java index 0c8d9ef92e..49516ab6f4 100644 --- a/library/src/main/java/com/google/android/exoplayer2/ui/SubtitleView.java +++ b/library/src/main/java/com/google/android/exoplayer2/ui/SubtitleView.java @@ -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); } /**