Skip to content

Commit

Permalink
Add missing Nullable annotation Player.EventListener.onTimelineChanged
Browse files Browse the repository at this point in the history
Issue: #4593

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=206911927
  • Loading branch information
erdemguven authored and ojw28 committed Aug 1, 2018
1 parent a3e3f64 commit ed18be4
Show file tree
Hide file tree
Showing 11 changed files with 22 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@

import android.content.Context;
import android.net.Uri;
import android.support.annotation.Nullable;
import android.view.KeyEvent;
import android.view.View;
import com.google.android.exoplayer2.C;
Expand Down Expand Up @@ -282,7 +283,7 @@ public void onPositionDiscontinuity(@DiscontinuityReason int reason) {

@Override
public void onTimelineChanged(
Timeline timeline, Object manifest, @TimelineChangeReason int reason) {
Timeline timeline, @Nullable Object manifest, @TimelineChangeReason int reason) {
updateCurrentItemIndex();
if (timeline.isEmpty()) {
castMediaQueueCreationPending = true;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -795,8 +795,8 @@ public void resumeAd() {
// Player.EventListener implementation.

@Override
public void onTimelineChanged(Timeline timeline, Object manifest,
@Player.TimelineChangeReason int reason) {
public void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
if (reason == Player.TIMELINE_CHANGE_REASON_RESET) {
// The player is being reset and this source will be released.
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -281,8 +281,8 @@ public void onPlayerError(ExoPlaybackException exception) {
}

@Override
public void onTimelineChanged(Timeline timeline, Object manifest,
@TimelineChangeReason int reason) {
public void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @TimelineChangeReason int reason) {
Callback callback = getCallback();
callback.onDurationChanged(LeanbackPlayerAdapter.this);
callback.onCurrentPositionChanged(LeanbackPlayerAdapter.this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -674,8 +674,8 @@ private class ExoPlayerEventListener extends Player.DefaultEventListener {
private int currentWindowCount;

@Override
public void onTimelineChanged(Timeline timeline, Object manifest,
@Player.TimelineChangeReason int reason) {
public void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
int windowCount = player.getCurrentTimeline().getWindowCount();
int windowIndex = player.getCurrentWindowIndex();
if (queueNavigator != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ interface EventListener {
* @param manifest The latest manifest. May be null.
* @param reason The {@link TimelineChangeReason} responsible for this timeline change.
*/
void onTimelineChanged(Timeline timeline, Object manifest, @TimelineChangeReason int reason);
void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @TimelineChangeReason int reason);

/**
* Called when the available or selected tracks change.
Expand Down Expand Up @@ -281,8 +282,8 @@ interface EventListener {
abstract class DefaultEventListener implements EventListener {

@Override
public void onTimelineChanged(Timeline timeline, Object manifest,
@TimelineChangeReason int reason) {
public void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @TimelineChangeReason int reason) {
// Call deprecated version. Otherwise, do nothing.
onTimelineChanged(timeline, manifest);
}
Expand Down Expand Up @@ -337,7 +338,7 @@ public void onSeekProcessed() {
* instead.
*/
@Deprecated
public void onTimelineChanged(Timeline timeline, Object manifest) {
public void onTimelineChanged(Timeline timeline, @Nullable Object manifest) {
// Do nothing.
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -420,7 +420,7 @@ public final void onDownstreamFormatChanged(

@Override
public final void onTimelineChanged(
Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
mediaPeriodQueueTracker.onTimelineChanged(timeline);
EventTime eventTime = generatePlayingMediaPeriodEventTime();
for (AnalyticsListener listener : listeners) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2078,7 +2078,7 @@ public void testRecursivePlayerChangesAreReportedInCorrectOrder() throws Excepti
final EventListener eventListener =
new DefaultEventListener() {
@Override
public void onTimelineChanged(Timeline timeline, Object manifest, int reason) {
public void onTimelineChanged(Timeline timeline, @Nullable Object manifest, int reason) {
if (timeline.isEmpty()) {
playerReference.get().setPlayWhenReady(/* playWhenReady= */ false);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1088,7 +1088,7 @@ public void onPositionDiscontinuity(@Player.DiscontinuityReason int reason) {

@Override
public void onTimelineChanged(
Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
updateNavigation();
updateTimeBarMode();
updateProgress();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -949,7 +949,7 @@ public void onPlayerStateChanged(boolean playWhenReady, int playbackState) {
}

@Override
public void onTimelineChanged(Timeline timeline, Object manifest, int reason) {
public void onTimelineChanged(Timeline timeline, @Nullable Object manifest, int reason) {
if (player == null || player.getPlaybackState() == Player.STATE_IDLE) {
return;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,9 @@ protected void doActionAndScheduleNextImpl(
new Player.DefaultEventListener() {
@Override
public void onTimelineChanged(
Timeline timeline, Object manifest, @Player.TimelineChangeReason int reason) {
Timeline timeline,
@Nullable Object manifest,
@Player.TimelineChangeReason int reason) {
if (expectedTimeline == null || timeline.equals(expectedTimeline)) {
player.removeListener(this);
nextAction.schedule(player, trackSelector, surface, handler);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -601,8 +601,8 @@ private void handleException(Exception exception) {
// Player.EventListener

@Override
public void onTimelineChanged(Timeline timeline, Object manifest,
@Player.TimelineChangeReason int reason) {
public void onTimelineChanged(
Timeline timeline, @Nullable Object manifest, @Player.TimelineChangeReason int reason) {
timelines.add(timeline);
manifests.add(manifest);
timelineChangeReasons.add(reason);
Expand Down

0 comments on commit ed18be4

Please sign in to comment.