Commit b2da61f7 by olly Committed by Oliver Woodman

Clean up MediaSessionExt documentation

-------------
Created by MOE: https://github.com/google/moe
MOE_MIGRATED_REVID=163828712
parent 395249a9
...@@ -21,40 +21,50 @@ import com.google.android.exoplayer2.C; ...@@ -21,40 +21,50 @@ import com.google.android.exoplayer2.C;
import com.google.android.exoplayer2.Player; import com.google.android.exoplayer2.Player;
/** /**
* A default implementation of the {@link MediaSessionConnector.PlaybackController}. You can safely * A default implementation of {@link MediaSessionConnector.PlaybackController}.
* override any method for instance to intercept calls for a given action. * <p>
* Methods can be safely overridden by subclasses to intercept calls for given actions.
*/ */
public class DefaultPlaybackController implements MediaSessionConnector.PlaybackController { public class DefaultPlaybackController implements MediaSessionConnector.PlaybackController {
/**
* The default fast forward increment, in milliseconds.
*/
public static final int DEFAULT_FAST_FORWARD_MS = 15000;
/**
* The default rewind increment, in milliseconds.
*/
public static final int DEFAULT_REWIND_MS = 5000;
private static final long BASE_ACTIONS = PlaybackStateCompat.ACTION_PLAY_PAUSE private static final long BASE_ACTIONS = PlaybackStateCompat.ACTION_PLAY_PAUSE
| PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE | PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE
| PlaybackStateCompat.ACTION_STOP; | PlaybackStateCompat.ACTION_STOP;
protected final long fastForwardIncrementMs;
protected final long rewindIncrementMs; protected final long rewindIncrementMs;
protected final long fastForwardIncrementMs;
/** /**
* Creates a new {@link DefaultPlaybackController}. This is equivalent to calling * Creates a new instance.
* {@code DefaultPlaybackController(15000L, 5000L)}. * <p>
* Equivalent to {@code DefaultPlaybackController(
* DefaultPlaybackController.DEFAULT_REWIND_MS,
* DefaultPlaybackController.DEFAULT_FAST_FORWARD_MS)}.
*/ */
public DefaultPlaybackController() { public DefaultPlaybackController() {
this(15000L, 5000L); this(DEFAULT_REWIND_MS, DEFAULT_FAST_FORWARD_MS);
} }
/** /**
* Creates a new {@link DefaultPlaybackController} and sets the fast forward and rewind increments * Creates a new instance with the given fast forward and rewind increments.
* in milliseconds.
* *
* @param fastForwardIncrementMs A positive value will cause the * @param rewindIncrementMs The rewind increment in milliseconds. A zero or negative value will
* {@link PlaybackStateCompat#ACTION_FAST_FORWARD} playback action to be added. A zero or a * cause the rewind action to be disabled.
* negative value will cause it to be removed. * @param fastForwardIncrementMs The fast forward increment in milliseconds. A zero or negative
* @param rewindIncrementMs A positive value will cause the * value will cause the fast forward action to be removed.
* {@link PlaybackStateCompat#ACTION_REWIND} playback action to be added. A zero or a
* negative value will cause it to be removed.
*/ */
public DefaultPlaybackController(long fastForwardIncrementMs, long rewindIncrementMs) { public DefaultPlaybackController(long rewindIncrementMs, long fastForwardIncrementMs) {
this.fastForwardIncrementMs = fastForwardIncrementMs;
this.rewindIncrementMs = rewindIncrementMs; this.rewindIncrementMs = rewindIncrementMs;
this.fastForwardIncrementMs = fastForwardIncrementMs;
} }
@Override @Override
......
...@@ -26,10 +26,13 @@ import com.google.android.exoplayer2.util.RepeatModeUtil; ...@@ -26,10 +26,13 @@ import com.google.android.exoplayer2.util.RepeatModeUtil;
*/ */
public final class RepeatModeActionProvider implements MediaSessionConnector.CustomActionProvider { public final class RepeatModeActionProvider implements MediaSessionConnector.CustomActionProvider {
/**
* The default repeat toggle modes.
*/
public static final @RepeatModeUtil.RepeatToggleModes int DEFAULT_REPEAT_TOGGLE_MODES =
RepeatModeUtil.REPEAT_TOGGLE_MODE_ONE | RepeatModeUtil.REPEAT_TOGGLE_MODE_ALL;
private static final String ACTION_REPEAT_MODE = "ACTION_EXO_REPEAT_MODE"; private static final String ACTION_REPEAT_MODE = "ACTION_EXO_REPEAT_MODE";
@RepeatModeUtil.RepeatToggleModes
private static final int DEFAULT_REPEAT_MODES = RepeatModeUtil.REPEAT_TOGGLE_MODE_ONE
| RepeatModeUtil.REPEAT_TOGGLE_MODE_ALL;
private final Player player; private final Player player;
@RepeatModeUtil.RepeatToggleModes @RepeatModeUtil.RepeatToggleModes
...@@ -39,20 +42,20 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus ...@@ -39,20 +42,20 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
private final CharSequence repeatOffDescription; private final CharSequence repeatOffDescription;
/** /**
* Creates a new {@link RepeatModeActionProvider}. * Creates a new instance.
* <p> * <p>
* This is equivalent to calling the two argument constructor with * Equivalent to {@code RepeatModeActionProvider(context, player,
* {@code RepeatModeUtil#REPEAT_TOGGLE_MODE_ONE | RepeatModeUtil#REPEAT_TOGGLE_MODE_ALL}. * RepeatModeActionProvider.DEFAULT_REPEAT_TOGGLE_MODES)}.
* *
* @param context The context. * @param context The context.
* @param player The player on which to toggle the repeat mode. * @param player The player on which to toggle the repeat mode.
*/ */
public RepeatModeActionProvider(Context context, Player player) { public RepeatModeActionProvider(Context context, Player player) {
this(context, player, DEFAULT_REPEAT_MODES); this(context, player, DEFAULT_REPEAT_TOGGLE_MODES);
} }
/** /**
* Creates a new {@link RepeatModeActionProvider} for the given repeat toggle modes. * Creates a new instance enabling the given repeat toggle modes.
* *
* @param context The context. * @param context The context.
* @param player The player on which to toggle the repeat mode. * @param player The player on which to toggle the repeat mode.
......
...@@ -29,9 +29,8 @@ import java.util.Collections; ...@@ -29,9 +29,8 @@ import java.util.Collections;
import java.util.List; import java.util.List;
/** /**
* An abstract implementation of the {@link MediaSessionConnector.QueueNavigator} that's based on an * An abstract implementation of the {@link MediaSessionConnector.QueueNavigator} that maps the
* {@link Player}'s current {@link Timeline} and maps the timeline of the player to the media * windows of a {@link Player}'s {@link Timeline} to the media session queue.
* session queue.
*/ */
public abstract class TimelineQueueNavigator implements MediaSessionConnector.QueueNavigator { public abstract class TimelineQueueNavigator implements MediaSessionConnector.QueueNavigator {
...@@ -44,10 +43,9 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu ...@@ -44,10 +43,9 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
private long activeQueueItemId; private long activeQueueItemId;
/** /**
* Creates a new timeline queue navigator for a given {@link MediaSessionCompat}. * Creates an instance for a given {@link MediaSessionCompat}.
* <p> * <p>
* This is equivalent to calling * Equivalent to {@code TimelineQueueNavigator(mediaSession, DEFAULT_MAX_QUEUE_SIZE)}.
* {@code #TimelineQueueNavigator(mediaSession, DEFAULT_MAX_QUEUE_SIZE)}.
* *
* @param mediaSession The {@link MediaSessionCompat}. * @param mediaSession The {@link MediaSessionCompat}.
*/ */
...@@ -56,12 +54,11 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu ...@@ -56,12 +54,11 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
} }
/** /**
* Creates a new timeline queue navigator for a given {@link MediaSessionCompat} and a maximum * Creates an instance for a given {@link MediaSessionCompat} and maximum queue size.
* queue size of {@code maxQueueSize}.
* <p> * <p>
* If the actual queue size is larger than {@code maxQueueSize} a floating window of * If the number of windows in the {@link Player}'s {@link Timeline} exceeds {@code maxQueueSize},
* {@code maxQueueSize} is applied and moved back and forth when the user is navigating within the * the media session queue will correspond to {@code maxQueueSize} windows centered on the one
* queue. * currently being played.
* *
* @param mediaSession The {@link MediaSessionCompat}. * @param mediaSession The {@link MediaSessionCompat}.
* @param maxQueueSize The maximum queue size. * @param maxQueueSize The maximum queue size.
...@@ -80,12 +77,6 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu ...@@ -80,12 +77,6 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
*/ */
public abstract MediaDescriptionCompat getMediaDescription(int windowIndex); public abstract MediaDescriptionCompat getMediaDescription(int windowIndex);
/**
* Supports the following media actions: {@code PlaybackStateCompat.ACTION_SKIP_TO_NEXT |
* PlaybackStateCompat.ACTION_SKIP_TO_PREVIOUS | PlaybackStateCompat.ACTION_SKIP_TO_QUEUE_ITEM}.
*
* @return The bit mask of the supported media actions.
*/
@Override @Override
public long getSupportedQueueNavigatorActions(Player player) { public long getSupportedQueueNavigatorActions(Player player) {
if (player == null || player.getCurrentTimeline().getWindowCount() < 2) { if (player == null || player.getCurrentTimeline().getWindowCount() < 2) {
......
...@@ -249,11 +249,23 @@ public class PlaybackControlView extends FrameLayout { ...@@ -249,11 +249,23 @@ public class PlaybackControlView extends FrameLayout {
}; };
/**
* The default fast forward increment, in milliseconds.
*/
public static final int DEFAULT_FAST_FORWARD_MS = 15000; public static final int DEFAULT_FAST_FORWARD_MS = 15000;
/**
* The default rewind increment, in milliseconds.
*/
public static final int DEFAULT_REWIND_MS = 5000; public static final int DEFAULT_REWIND_MS = 5000;
/**
* The default show timeout, in milliseconds.
*/
public static final int DEFAULT_SHOW_TIMEOUT_MS = 5000; public static final int DEFAULT_SHOW_TIMEOUT_MS = 5000;
public static final @RepeatModeUtil.RepeatToggleModes int DEFAULT_REPEAT_TOGGLE_MODES /**
= RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE; * The default repeat toggle modes.
*/
public static final @RepeatModeUtil.RepeatToggleModes int DEFAULT_REPEAT_TOGGLE_MODES =
RepeatModeUtil.REPEAT_TOGGLE_MODE_NONE;
/** /**
* The maximum number of windows that can be shown in a multi-window time bar. * The maximum number of windows that can be shown in a multi-window time bar.
......
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