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;
import com.google.android.exoplayer2.Player;
/**
* A default implementation of the {@link MediaSessionConnector.PlaybackController}. You can safely
* override any method for instance to intercept calls for a given action.
* A default implementation of {@link MediaSessionConnector.PlaybackController}.
* <p>
* Methods can be safely overridden by subclasses to intercept calls for given actions.
*/
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
| PlaybackStateCompat.ACTION_PLAY | PlaybackStateCompat.ACTION_PAUSE
| PlaybackStateCompat.ACTION_STOP;
protected final long fastForwardIncrementMs;
protected final long rewindIncrementMs;
protected final long fastForwardIncrementMs;
/**
* Creates a new {@link DefaultPlaybackController}. This is equivalent to calling
* {@code DefaultPlaybackController(15000L, 5000L)}.
* Creates a new instance.
* <p>
* Equivalent to {@code DefaultPlaybackController(
* DefaultPlaybackController.DEFAULT_REWIND_MS,
* DefaultPlaybackController.DEFAULT_FAST_FORWARD_MS)}.
*/
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
* in milliseconds.
* Creates a new instance with the given fast forward and rewind increments.
*
* @param fastForwardIncrementMs A positive value will cause the
* {@link PlaybackStateCompat#ACTION_FAST_FORWARD} playback action to be added. A zero or a
* negative value will cause it to be removed.
* @param rewindIncrementMs A positive value will cause the
* {@link PlaybackStateCompat#ACTION_REWIND} playback action to be added. A zero or a
* negative value will cause it to be removed.
* @param rewindIncrementMs The rewind increment in milliseconds. A zero or negative value will
* cause the rewind action to be disabled.
* @param fastForwardIncrementMs The fast forward increment in milliseconds. A zero or negative
* value will cause the fast forward action to be removed.
*/
public DefaultPlaybackController(long fastForwardIncrementMs, long rewindIncrementMs) {
this.fastForwardIncrementMs = fastForwardIncrementMs;
public DefaultPlaybackController(long rewindIncrementMs, long fastForwardIncrementMs) {
this.rewindIncrementMs = rewindIncrementMs;
this.fastForwardIncrementMs = fastForwardIncrementMs;
}
@Override
......
......@@ -26,10 +26,13 @@ import com.google.android.exoplayer2.util.RepeatModeUtil;
*/
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";
@RepeatModeUtil.RepeatToggleModes
private static final int DEFAULT_REPEAT_MODES = RepeatModeUtil.REPEAT_TOGGLE_MODE_ONE
| RepeatModeUtil.REPEAT_TOGGLE_MODE_ALL;
private final Player player;
@RepeatModeUtil.RepeatToggleModes
......@@ -39,20 +42,20 @@ public final class RepeatModeActionProvider implements MediaSessionConnector.Cus
private final CharSequence repeatOffDescription;
/**
* Creates a new {@link RepeatModeActionProvider}.
* Creates a new instance.
* <p>
* This is equivalent to calling the two argument constructor with
* {@code RepeatModeUtil#REPEAT_TOGGLE_MODE_ONE | RepeatModeUtil#REPEAT_TOGGLE_MODE_ALL}.
* Equivalent to {@code RepeatModeActionProvider(context, player,
* RepeatModeActionProvider.DEFAULT_REPEAT_TOGGLE_MODES)}.
*
* @param context The context.
* @param player The player on which to toggle the repeat mode.
*/
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 player The player on which to toggle the repeat mode.
......
......@@ -29,9 +29,8 @@ import java.util.Collections;
import java.util.List;
/**
* An abstract implementation of the {@link MediaSessionConnector.QueueNavigator} that's based on an
* {@link Player}'s current {@link Timeline} and maps the timeline of the player to the media
* session queue.
* An abstract implementation of the {@link MediaSessionConnector.QueueNavigator} that maps the
* windows of a {@link Player}'s {@link Timeline} to the media session queue.
*/
public abstract class TimelineQueueNavigator implements MediaSessionConnector.QueueNavigator {
......@@ -44,10 +43,9 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
private long activeQueueItemId;
/**
* Creates a new timeline queue navigator for a given {@link MediaSessionCompat}.
* Creates an instance for a given {@link MediaSessionCompat}.
* <p>
* This is equivalent to calling
* {@code #TimelineQueueNavigator(mediaSession, DEFAULT_MAX_QUEUE_SIZE)}.
* Equivalent to {@code TimelineQueueNavigator(mediaSession, DEFAULT_MAX_QUEUE_SIZE)}.
*
* @param mediaSession The {@link MediaSessionCompat}.
*/
......@@ -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
* queue size of {@code maxQueueSize}.
* Creates an instance for a given {@link MediaSessionCompat} and maximum queue size.
* <p>
* If the actual queue size is larger than {@code maxQueueSize} a floating window of
* {@code maxQueueSize} is applied and moved back and forth when the user is navigating within the
* queue.
* If the number of windows in the {@link Player}'s {@link Timeline} exceeds {@code maxQueueSize},
* the media session queue will correspond to {@code maxQueueSize} windows centered on the one
* currently being played.
*
* @param mediaSession The {@link MediaSessionCompat}.
* @param maxQueueSize The maximum queue size.
......@@ -80,12 +77,6 @@ public abstract class TimelineQueueNavigator implements MediaSessionConnector.Qu
*/
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
public long getSupportedQueueNavigatorActions(Player player) {
if (player == null || player.getCurrentTimeline().getWindowCount() < 2) {
......
......@@ -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;
/**
* The default rewind increment, in milliseconds.
*/
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 @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.
......
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