Commit 591bd6e4 by tonihei Committed by Toni

Fix UI module API nullability annotations and make non-null-by-default.

PiperOrigin-RevId: 261872025
parent 346f8e67
...@@ -285,7 +285,7 @@ public class PlayerControlView extends FrameLayout { ...@@ -285,7 +285,7 @@ public class PlayerControlView extends FrameLayout {
} }
public PlayerControlView(Context context, @Nullable AttributeSet attrs) { public PlayerControlView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, /* defStyleAttr= */ 0);
} }
public PlayerControlView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) { public PlayerControlView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
...@@ -494,9 +494,10 @@ public class PlayerControlView extends FrameLayout { ...@@ -494,9 +494,10 @@ public class PlayerControlView extends FrameLayout {
/** /**
* Sets the {@link VisibilityListener}. * Sets the {@link VisibilityListener}.
* *
* @param listener The listener to be notified about visibility changes. * @param listener The listener to be notified about visibility changes, or null to remove the
* current listener.
*/ */
public void setVisibilityListener(VisibilityListener listener) { public void setVisibilityListener(@Nullable VisibilityListener listener) {
this.visibilityListener = listener; this.visibilityListener = listener;
} }
...@@ -512,7 +513,8 @@ public class PlayerControlView extends FrameLayout { ...@@ -512,7 +513,8 @@ public class PlayerControlView extends FrameLayout {
/** /**
* Sets the {@link PlaybackPreparer}. * Sets the {@link PlaybackPreparer}.
* *
* @param playbackPreparer The {@link PlaybackPreparer}. * @param playbackPreparer The {@link PlaybackPreparer}, or null to remove the current playback
* preparer.
*/ */
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) { public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
this.playbackPreparer = playbackPreparer; this.playbackPreparer = playbackPreparer;
......
...@@ -308,14 +308,14 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -308,14 +308,14 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
private static final int PICTURE_TYPE_NOT_SET = -1; private static final int PICTURE_TYPE_NOT_SET = -1;
public PlayerView(Context context) { public PlayerView(Context context) {
this(context, null); this(context, /* attrs= */ null);
} }
public PlayerView(Context context, AttributeSet attrs) { public PlayerView(Context context, @Nullable AttributeSet attrs) {
this(context, attrs, 0); this(context, attrs, /* defStyleAttr= */ 0);
} }
public PlayerView(Context context, AttributeSet attrs, int defStyleAttr) { public PlayerView(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr); super(context, attrs, defStyleAttr);
if (isInEditMode()) { if (isInEditMode()) {
...@@ -505,6 +505,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -505,6 +505,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
} }
/** Returns the player currently set on this view, or null if no player is set. */ /** Returns the player currently set on this view, or null if no player is set. */
@Nullable
public Player getPlayer() { public Player getPlayer() {
return player; return player;
} }
...@@ -904,9 +905,11 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -904,9 +905,11 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
/** /**
* Set the {@link PlayerControlView.VisibilityListener}. * Set the {@link PlayerControlView.VisibilityListener}.
* *
* @param listener The listener to be notified about visibility changes. * @param listener The listener to be notified about visibility changes, or null to remove the
* current listener.
*/ */
public void setControllerVisibilityListener(PlayerControlView.VisibilityListener listener) { public void setControllerVisibilityListener(
@Nullable PlayerControlView.VisibilityListener listener) {
Assertions.checkState(controller != null); Assertions.checkState(controller != null);
controller.setVisibilityListener(listener); controller.setVisibilityListener(listener);
} }
...@@ -914,7 +917,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -914,7 +917,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
/** /**
* Sets the {@link PlaybackPreparer}. * Sets the {@link PlaybackPreparer}.
* *
* @param playbackPreparer The {@link PlaybackPreparer}. * @param playbackPreparer The {@link PlaybackPreparer}, or null to remove the current playback
* preparer.
*/ */
public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) { public void setPlaybackPreparer(@Nullable PlaybackPreparer playbackPreparer) {
Assertions.checkState(controller != null); Assertions.checkState(controller != null);
...@@ -1006,7 +1010,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -1006,7 +1010,8 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* @param listener The listener to be notified about aspect ratios changes of the video content or * @param listener The listener to be notified about aspect ratios changes of the video content or
* the content frame. * the content frame.
*/ */
public void setAspectRatioListener(AspectRatioFrameLayout.AspectRatioListener listener) { public void setAspectRatioListener(
@Nullable AspectRatioFrameLayout.AspectRatioListener listener) {
Assertions.checkState(contentFrame != null); Assertions.checkState(contentFrame != null);
contentFrame.setAspectRatioListener(listener); contentFrame.setAspectRatioListener(listener);
} }
...@@ -1025,6 +1030,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -1025,6 +1030,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* @return The {@link SurfaceView}, {@link TextureView}, {@link SphericalSurfaceView} or {@code * @return The {@link SurfaceView}, {@link TextureView}, {@link SphericalSurfaceView} or {@code
* null}. * null}.
*/ */
@Nullable
public View getVideoSurfaceView() { public View getVideoSurfaceView() {
return surfaceView; return surfaceView;
} }
...@@ -1047,6 +1053,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider ...@@ -1047,6 +1053,7 @@ public class PlayerView extends FrameLayout implements AdsLoader.AdViewProvider
* @return The {@link SubtitleView}, or {@code null} if the layout has been customized and the * @return The {@link SubtitleView}, or {@code null} if the layout has been customized and the
* subtitle view is not present. * subtitle view is not present.
*/ */
@Nullable
public SubtitleView getSubtitleView() { public SubtitleView getSubtitleView() {
return subtitleView; return subtitleView;
} }
......
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@NonNullApi
package com.google.android.exoplayer2.ui;
import com.google.android.exoplayer2.util.NonNullApi;
/*
* Copyright (C) 2019 The Android Open Source Project
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
@NonNullApi
package com.google.android.exoplayer2.ui.spherical;
import com.google.android.exoplayer2.util.NonNullApi;
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