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;
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
Log.d(TAG, "shuffleModeEnabled [" + shuffleModeEnabled + "]");
}
@Override
public void onPositionDiscontinuity() {
Log.d(TAG, "positionDiscontinuity");
}
......
......@@ -502,6 +502,11 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPositionDiscontinuity() {
if (inErrorState) {
// 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 {
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
private void releasePlayerAndQuitLooper() {
player.release();
Looper.myLooper().quit();
......
......@@ -567,6 +567,11 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException error) {
if (playingAd) {
for (int i = 0; i < adCallbacks.size(); i++) {
......
......@@ -271,6 +271,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter {
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
// SimpleExoplayerView.Callback implementation.
@Override
......
......@@ -620,6 +620,11 @@ public final class MediaSessionConnector {
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// TODO: Support shuffle mode in MediaSessionConnector.
}
@Override
public void onPlayerError(ExoPlaybackException error) {
playbackException = error;
updateMediaSessionPlaybackState();
......
......@@ -132,6 +132,11 @@ public class OpusPlaybackTest extends InstrumentationTestCase {
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
private void releasePlayerAndQuitLooper() {
player.release();
Looper.myLooper().quit();
......
......@@ -164,6 +164,11 @@ public class VpxPlaybackTest extends InstrumentationTestCase {
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
private void releasePlayerAndQuitLooper() {
player.release();
Looper.myLooper().quit();
......
......@@ -195,6 +195,9 @@ import java.util.concurrent.CopyOnWriteArraySet;
public void setShuffleModeEnabled(boolean shuffleModeEnabled) {
if (this.shuffleModeEnabled != shuffleModeEnabled) {
this.shuffleModeEnabled = shuffleModeEnabled;
for (Player.EventListener listener : listeners) {
listener.onShuffleModeEnabledChanged(shuffleModeEnabled);
}
}
}
......@@ -527,3 +530,4 @@ import java.util.concurrent.CopyOnWriteArraySet;
}
}
......@@ -95,6 +95,13 @@ public interface Player {
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}
* 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.
......
......@@ -94,6 +94,11 @@ public final class DebugTextViewHelper implements Runnable, Player.EventListener
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPositionDiscontinuity() {
updateAndPost();
}
......
......@@ -1080,6 +1080,11 @@ public class PlaybackControlView extends FrameLayout {
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// TODO: Update UI.
}
@Override
public void onPositionDiscontinuity() {
updateNavigation();
updateProgress();
......
......@@ -897,6 +897,11 @@ public final class SimpleExoPlayerView extends FrameLayout {
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException e) {
// Do nothing.
}
......
......@@ -412,6 +412,11 @@ public abstract class Action {
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
}
@Override
public void onPlayerError(ExoPlaybackException error) {
}
......
......@@ -236,6 +236,11 @@ public abstract class ExoHostedTest implements HostedTest, Player.EventListener,
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public final void onPlayerError(ExoPlaybackException error) {
playerWasPrepared = true;
playerError = error;
......
......@@ -361,6 +361,11 @@ public final class ExoPlayerTestRunner implements Player.EventListener {
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException error) {
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