Remove some UI classes from nullness blacklist

PiperOrigin-RevId: 256751627
This commit is contained in:
olly 2019-07-06 11:09:36 +01:00 committed by Oliver Woodman
parent e852ff1dfa
commit ecd88c71d2
3 changed files with 25 additions and 15 deletions

View File

@ -18,6 +18,7 @@ package com.google.android.exoplayer2.ui;
import android.content.Context;
import android.content.res.TypedArray;
import androidx.annotation.IntDef;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.widget.FrameLayout;
import java.lang.annotation.Documented;
@ -97,16 +98,16 @@ public final class AspectRatioFrameLayout extends FrameLayout {
private final AspectRatioUpdateDispatcher aspectRatioUpdateDispatcher;
private AspectRatioListener aspectRatioListener;
@Nullable private AspectRatioListener aspectRatioListener;
private float videoAspectRatio;
private @ResizeMode int resizeMode;
@ResizeMode private int resizeMode;
public AspectRatioFrameLayout(Context context) {
this(context, null);
this(context, /* attrs= */ null);
}
public AspectRatioFrameLayout(Context context, AttributeSet attrs) {
public AspectRatioFrameLayout(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
resizeMode = RESIZE_MODE_FIT;
if (attrs != null) {
@ -136,9 +137,10 @@ public final class AspectRatioFrameLayout extends FrameLayout {
/**
* Sets the {@link AspectRatioListener}.
*
* @param listener The listener to be notified about aspect ratios changes.
* @param listener The listener to be notified about aspect ratios changes, or null to clear a
* listener that was previously set.
*/
public void setAspectRatioListener(AspectRatioListener listener) {
public void setAspectRatioListener(@Nullable AspectRatioListener listener) {
this.aspectRatioListener = listener;
}

View File

@ -281,19 +281,22 @@ public class PlayerControlView extends FrameLayout {
private long currentWindowOffset;
public PlayerControlView(Context context) {
this(context, null);
this(context, /* attrs= */ null);
}
public PlayerControlView(Context context, AttributeSet attrs) {
public PlayerControlView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0);
}
public PlayerControlView(Context context, AttributeSet attrs, int defStyleAttr) {
public PlayerControlView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
this(context, attrs, defStyleAttr, attrs);
}
public PlayerControlView(
Context context, AttributeSet attrs, int defStyleAttr, AttributeSet playbackAttrs) {
Context context,
@Nullable AttributeSet attrs,
int defStyleAttr,
@Nullable AttributeSet playbackAttrs) {
super(context, attrs, defStyleAttr);
int controllerLayoutId = R.layout.exo_player_control_view;
rewindMs = DEFAULT_REWIND_MS;

View File

@ -53,8 +53,8 @@ public final class SubtitleView extends View implements TextOutput {
private final List<SubtitlePainter> painters;
private List<Cue> cues;
private @Cue.TextSizeType int textSizeType;
@Nullable private List<Cue> cues;
@Cue.TextSizeType private int textSizeType;
private float textSize;
private boolean applyEmbeddedStyles;
private boolean applyEmbeddedFontSizes;
@ -62,10 +62,10 @@ public final class SubtitleView extends View implements TextOutput {
private float bottomPaddingFraction;
public SubtitleView(Context context) {
this(context, null);
this(context, /* attrs= */ null);
}
public SubtitleView(Context context, AttributeSet attrs) {
public SubtitleView(Context context, @Nullable AttributeSet attrs) {
super(context, attrs);
painters = new ArrayList<>();
textSizeType = Cue.TEXT_SIZE_TYPE_FRACTIONAL;
@ -246,7 +246,11 @@ public final class SubtitleView extends View implements TextOutput {
@Override
public void dispatchDraw(Canvas canvas) {
int cueCount = (cues == null) ? 0 : cues.size();
List<Cue> cues = this.cues;
if (cues == null || cues.isEmpty()) {
return;
}
int rawViewHeight = getHeight();
// Calculate the cue box bounds relative to the canvas after padding is taken into account.
@ -267,6 +271,7 @@ public final class SubtitleView extends View implements TextOutput {
return;
}
int cueCount = cues.size();
for (int i = 0; i < cueCount; i++) {
Cue cue = cues.get(i);
float cueTextSizePx = resolveCueTextSize(cue, rawViewHeight, viewHeightMinusPadding);