Commit b9a6a405 by tonihei Committed by Oliver Woodman

Add listener callback for shuffle mode changes.

The listener implementations do not do anything yet.

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=166056933
parent 52ec70dd
...@@ -100,6 +100,11 @@ import java.util.Locale; ...@@ -100,6 +100,11 @@ import java.util.Locale;
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
Log.d(TAG, "shuffleModeEnabled [" + shuffleModeEnabled + "]");
}
@Override
public void onPositionDiscontinuity() { public void onPositionDiscontinuity() {
Log.d(TAG, "positionDiscontinuity"); Log.d(TAG, "positionDiscontinuity");
} }
......
...@@ -502,6 +502,11 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi ...@@ -502,6 +502,11 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPositionDiscontinuity() { public void onPositionDiscontinuity() {
if (inErrorState) { if (inErrorState) {
// This will only occur if the user has performed a seek whilst in the error state. Update the // This will only occur if the user has performed a seek whilst in the error state. Update the
......
...@@ -132,6 +132,11 @@ public class FlacPlaybackTest extends InstrumentationTestCase { ...@@ -132,6 +132,11 @@ public class FlacPlaybackTest extends InstrumentationTestCase {
// Do nothing. // Do nothing.
} }
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
private void releasePlayerAndQuitLooper() { private void releasePlayerAndQuitLooper() {
player.release(); player.release();
Looper.myLooper().quit(); Looper.myLooper().quit();
......
...@@ -567,6 +567,11 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer, ...@@ -567,6 +567,11 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException error) { public void onPlayerError(ExoPlaybackException error) {
if (playingAd) { if (playingAd) {
for (int i = 0; i < adCallbacks.size(); i++) { for (int i = 0; i < adCallbacks.size(); i++) {
......
...@@ -271,6 +271,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter { ...@@ -271,6 +271,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter {
// Do nothing. // Do nothing.
} }
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
// SimpleExoplayerView.Callback implementation. // SimpleExoplayerView.Callback implementation.
@Override @Override
......
...@@ -620,6 +620,11 @@ public final class MediaSessionConnector { ...@@ -620,6 +620,11 @@ public final class MediaSessionConnector {
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// TODO: Support shuffle mode in MediaSessionConnector.
}
@Override
public void onPlayerError(ExoPlaybackException error) { public void onPlayerError(ExoPlaybackException error) {
playbackException = error; playbackException = error;
updateMediaSessionPlaybackState(); updateMediaSessionPlaybackState();
......
...@@ -132,6 +132,11 @@ public class OpusPlaybackTest extends InstrumentationTestCase { ...@@ -132,6 +132,11 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
// Do nothing. // Do nothing.
} }
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
private void releasePlayerAndQuitLooper() { private void releasePlayerAndQuitLooper() {
player.release(); player.release();
Looper.myLooper().quit(); Looper.myLooper().quit();
......
...@@ -164,6 +164,11 @@ public class VpxPlaybackTest extends InstrumentationTestCase { ...@@ -164,6 +164,11 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
// Do nothing. // Do nothing.
} }
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
private void releasePlayerAndQuitLooper() { private void releasePlayerAndQuitLooper() {
player.release(); player.release();
Looper.myLooper().quit(); Looper.myLooper().quit();
......
...@@ -195,6 +195,9 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -195,6 +195,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
public void setShuffleModeEnabled(boolean shuffleModeEnabled) { public void setShuffleModeEnabled(boolean shuffleModeEnabled) {
if (this.shuffleModeEnabled != shuffleModeEnabled) { if (this.shuffleModeEnabled != shuffleModeEnabled) {
this.shuffleModeEnabled = shuffleModeEnabled; this.shuffleModeEnabled = shuffleModeEnabled;
for (Player.EventListener listener : listeners) {
listener.onShuffleModeEnabledChanged(shuffleModeEnabled);
}
} }
} }
...@@ -527,3 +530,4 @@ import java.util.concurrent.CopyOnWriteArraySet; ...@@ -527,3 +530,4 @@ import java.util.concurrent.CopyOnWriteArraySet;
} }
} }
...@@ -95,6 +95,13 @@ public interface Player { ...@@ -95,6 +95,13 @@ public interface Player {
void onRepeatModeChanged(@RepeatMode int repeatMode); void onRepeatModeChanged(@RepeatMode int repeatMode);
/** /**
* Called when the value of {@link #getShuffleModeEnabled()} changes.
*
* @param shuffleModeEnabled Whether shuffling of windows is enabled.
*/
void onShuffleModeEnabledChanged(boolean shuffleModeEnabled);
/**
* Called when an error occurs. The playback state will transition to {@link #STATE_IDLE} * Called when an error occurs. The playback state will transition to {@link #STATE_IDLE}
* immediately after this method is called. The player instance can still be used, and * immediately after this method is called. The player instance can still be used, and
* {@link #release()} must still be called on the player should it no longer be required. * {@link #release()} must still be called on the player should it no longer be required.
......
...@@ -94,6 +94,11 @@ public final class DebugTextViewHelper implements Runnable, Player.EventListener ...@@ -94,6 +94,11 @@ public final class DebugTextViewHelper implements Runnable, Player.EventListener
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPositionDiscontinuity() { public void onPositionDiscontinuity() {
updateAndPost(); updateAndPost();
} }
......
...@@ -1080,6 +1080,11 @@ public class PlaybackControlView extends FrameLayout { ...@@ -1080,6 +1080,11 @@ public class PlaybackControlView extends FrameLayout {
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// TODO: Update UI.
}
@Override
public void onPositionDiscontinuity() { public void onPositionDiscontinuity() {
updateNavigation(); updateNavigation();
updateProgress(); updateProgress();
......
...@@ -897,6 +897,11 @@ public final class SimpleExoPlayerView extends FrameLayout { ...@@ -897,6 +897,11 @@ public final class SimpleExoPlayerView extends FrameLayout {
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException e) { public void onPlayerError(ExoPlaybackException e) {
// Do nothing. // Do nothing.
} }
......
...@@ -412,6 +412,11 @@ public abstract class Action { ...@@ -412,6 +412,11 @@ public abstract class Action {
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
}
@Override
public void onPlayerError(ExoPlaybackException error) { public void onPlayerError(ExoPlaybackException error) {
} }
......
...@@ -236,6 +236,11 @@ public abstract class ExoHostedTest implements HostedTest, Player.EventListener, ...@@ -236,6 +236,11 @@ public abstract class ExoHostedTest implements HostedTest, Player.EventListener,
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public final void onPlayerError(ExoPlaybackException error) { public final void onPlayerError(ExoPlaybackException error) {
playerWasPrepared = true; playerWasPrepared = true;
playerError = error; playerError = error;
......
...@@ -361,6 +361,11 @@ public final class ExoPlayerTestRunner implements Player.EventListener { ...@@ -361,6 +361,11 @@ public final class ExoPlayerTestRunner implements Player.EventListener {
} }
@Override @Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException error) { public void onPlayerError(ExoPlaybackException error) {
handleException(exception); handleException(exception);
} }
......
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