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
This commit is contained in:
tonihei 2017-08-22 07:27:27 -07:00 committed by Oliver Woodman
parent 52ec70dd80
commit b9a6a40539
16 changed files with 81 additions and 0 deletions

View File

@ -99,6 +99,11 @@ import java.util.Locale;
Log.d(TAG, "repeatMode [" + getRepeatModeString(repeatMode) + "]");
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
Log.d(TAG, "shuffleModeEnabled [" + shuffleModeEnabled + "]");
}
@Override
public void onPositionDiscontinuity() {
Log.d(TAG, "positionDiscontinuity");

View File

@ -501,6 +501,11 @@ public class PlayerActivity extends Activity implements OnClickListener, EventLi
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPositionDiscontinuity() {
if (inErrorState) {

View File

@ -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();

View File

@ -566,6 +566,11 @@ public final class ImaAdsLoader implements Player.EventListener, VideoAdPlayer,
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException error) {
if (playingAd) {

View File

@ -271,6 +271,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter {
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
// SimpleExoplayerView.Callback implementation.
@Override

View File

@ -619,6 +619,11 @@ public final class MediaSessionConnector {
updateMediaSessionPlaybackState();
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// TODO: Support shuffle mode in MediaSessionConnector.
}
@Override
public void onPlayerError(ExoPlaybackException error) {
playbackException = error;

View File

@ -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();

View File

@ -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();

View File

@ -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;
}
}

View File

@ -94,6 +94,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

View File

@ -93,6 +93,11 @@ public final class DebugTextViewHelper implements Runnable, Player.EventListener
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPositionDiscontinuity() {
updateAndPost();

View File

@ -1079,6 +1079,11 @@ public class PlaybackControlView extends FrameLayout {
updateNavigation();
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// TODO: Update UI.
}
@Override
public void onPositionDiscontinuity() {
updateNavigation();

View File

@ -896,6 +896,11 @@ public final class SimpleExoPlayerView extends FrameLayout {
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException e) {
// Do nothing.

View File

@ -411,6 +411,11 @@ public abstract class Action {
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
}
@Override
public void onPlayerError(ExoPlaybackException error) {

View File

@ -235,6 +235,11 @@ public abstract class ExoHostedTest implements HostedTest, Player.EventListener,
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public final void onPlayerError(ExoPlaybackException error) {
playerWasPrepared = true;

View File

@ -360,6 +360,11 @@ public final class ExoPlayerTestRunner implements Player.EventListener {
// Do nothing.
}
@Override
public void onShuffleModeEnabledChanged(boolean shuffleModeEnabled) {
// Do nothing.
}
@Override
public void onPlayerError(ExoPlaybackException error) {
handleException(exception);