Remove deprecated UI methods
PiperOrigin-RevId: 371809078
This commit is contained in:
parent
dd0981a5b6
commit
a264a0a04f
@ -117,6 +117,16 @@
|
|||||||
`ControlDispatcher` that implements custom preparation logic in
|
`ControlDispatcher` that implements custom preparation logic in
|
||||||
`dispatchPrepare`. Extend `DefaultControlDispatcher` to avoid having to
|
`dispatchPrepare`. Extend `DefaultControlDispatcher` to avoid having to
|
||||||
implement the other `ControlDispatcher` methods.
|
implement the other `ControlDispatcher` methods.
|
||||||
|
* Remove `setRewindIncrementMs` and `setFastForwardIncrementMs` from UI
|
||||||
|
components. Use `setControlDispatcher` on the same components, passing
|
||||||
|
a `DefaultControlDispatcher` built using
|
||||||
|
`DefaultControlDispatcher(long, long)`.
|
||||||
|
* Remove `PlayerNotificationManager` constructors and `createWith`
|
||||||
|
methods. Use `PlayerNotificationManager.Builder` instead.
|
||||||
|
* Remove `PlayerNotificationManager` `setUseNavigationActions` and
|
||||||
|
`setUseNavigationActionsInCompactView`. Use `setUseNextAction`,
|
||||||
|
`setUsePreviousAction`, `setUseNextActionInCompactView` and
|
||||||
|
`setUsePreviousActionInCompactView` instead.
|
||||||
* DRM:
|
* DRM:
|
||||||
* Only dispatch DRM session acquire and release events once per period
|
* Only dispatch DRM session acquire and release events once per period
|
||||||
when playing content that uses the same encryption keys for both audio &
|
when playing content that uses the same encryption keys for both audio &
|
||||||
|
@ -551,32 +551,6 @@ public final class MediaSessionConnector {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)} instead.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public void setRewindIncrementMs(int rewindMs) {
|
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
|
||||||
((DefaultControlDispatcher) controlDispatcher).setRewindIncrementMs(rewindMs);
|
|
||||||
invalidateMediaSessionPlaybackState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)} instead.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public void setFastForwardIncrementMs(int fastForwardMs) {
|
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
|
||||||
((DefaultControlDispatcher) controlDispatcher).setFastForwardIncrementMs(fastForwardMs);
|
|
||||||
invalidateMediaSessionPlaybackState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets the optional {@link ErrorMessageProvider}.
|
* Sets the optional {@link ErrorMessageProvider}.
|
||||||
*
|
*
|
||||||
|
@ -29,9 +29,8 @@ public class DefaultControlDispatcher implements ControlDispatcher {
|
|||||||
private static final int MAX_POSITION_FOR_SEEK_TO_PREVIOUS = 3000;
|
private static final int MAX_POSITION_FOR_SEEK_TO_PREVIOUS = 3000;
|
||||||
|
|
||||||
private final Timeline.Window window;
|
private final Timeline.Window window;
|
||||||
|
private final long rewindIncrementMs;
|
||||||
private long rewindIncrementMs;
|
private final long fastForwardIncrementMs;
|
||||||
private long fastForwardIncrementMs;
|
|
||||||
|
|
||||||
/** Creates an instance. */
|
/** Creates an instance. */
|
||||||
public DefaultControlDispatcher() {
|
public DefaultControlDispatcher() {
|
||||||
@ -168,24 +167,6 @@ public class DefaultControlDispatcher implements ControlDispatcher {
|
|||||||
return fastForwardIncrementMs;
|
return fastForwardIncrementMs;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Create a new instance instead and pass the new instance to the UI component. This
|
|
||||||
* makes sure the UI gets updated and is in sync with the new values.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setRewindIncrementMs(long rewindMs) {
|
|
||||||
this.rewindIncrementMs = rewindMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Create a new instance instead and pass the new instance to the UI component. This
|
|
||||||
* makes sure the UI gets updated and is in sync with the new values.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public void setFastForwardIncrementMs(long fastForwardMs) {
|
|
||||||
this.fastForwardIncrementMs = fastForwardMs;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Internal methods.
|
// Internal methods.
|
||||||
|
|
||||||
private static void seekToOffset(Player player, long offsetMs) {
|
private static void seekToOffset(Player player, long offsetMs) {
|
||||||
|
@ -666,32 +666,6 @@ public class PlayerControlView extends FrameLayout {
|
|||||||
updateNavigation();
|
updateNavigation();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)}.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public void setRewindIncrementMs(int rewindMs) {
|
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
|
||||||
((DefaultControlDispatcher) controlDispatcher).setRewindIncrementMs(rewindMs);
|
|
||||||
updateNavigation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)}.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public void setFastForwardIncrementMs(int fastForwardMs) {
|
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
|
||||||
((DefaultControlDispatcher) controlDispatcher).setFastForwardIncrementMs(fastForwardMs);
|
|
||||||
updateNavigation();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Returns the playback controls timeout. The playback controls are automatically hidden after
|
* Returns the playback controls timeout. The playback controls are automatically hidden after
|
||||||
* this duration of time has elapsed without user input.
|
* this duration of time has elapsed without user input.
|
||||||
|
@ -45,7 +45,6 @@ import android.support.v4.media.session.MediaSessionCompat;
|
|||||||
import androidx.annotation.DrawableRes;
|
import androidx.annotation.DrawableRes;
|
||||||
import androidx.annotation.IntDef;
|
import androidx.annotation.IntDef;
|
||||||
import androidx.annotation.Nullable;
|
import androidx.annotation.Nullable;
|
||||||
import androidx.annotation.StringRes;
|
|
||||||
import androidx.core.app.NotificationCompat;
|
import androidx.core.app.NotificationCompat;
|
||||||
import androidx.core.app.NotificationManagerCompat;
|
import androidx.core.app.NotificationManagerCompat;
|
||||||
import androidx.media.app.NotificationCompat.MediaStyle;
|
import androidx.media.app.NotificationCompat.MediaStyle;
|
||||||
@ -660,152 +659,6 @@ public class PlayerNotificationManager {
|
|||||||
private boolean useChronometer;
|
private boolean useChronometer;
|
||||||
@Nullable private String groupKey;
|
@Nullable private String groupKey;
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public static PlayerNotificationManager createWithNotificationChannel(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
@StringRes int channelName,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter) {
|
|
||||||
return createWithNotificationChannel(
|
|
||||||
context,
|
|
||||||
channelId,
|
|
||||||
channelName,
|
|
||||||
/* channelDescription= */ 0,
|
|
||||||
notificationId,
|
|
||||||
mediaDescriptionAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@Deprecated
|
|
||||||
public static PlayerNotificationManager createWithNotificationChannel(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
@StringRes int channelName,
|
|
||||||
@StringRes int channelDescription,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter) {
|
|
||||||
NotificationUtil.createNotificationChannel(
|
|
||||||
context, channelId, channelName, channelDescription, NotificationUtil.IMPORTANCE_LOW);
|
|
||||||
return new PlayerNotificationManager(
|
|
||||||
context, channelId, notificationId, mediaDescriptionAdapter);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@Deprecated
|
|
||||||
public static PlayerNotificationManager createWithNotificationChannel(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
@StringRes int channelName,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter,
|
|
||||||
@Nullable NotificationListener notificationListener) {
|
|
||||||
return createWithNotificationChannel(
|
|
||||||
context,
|
|
||||||
channelId,
|
|
||||||
channelName,
|
|
||||||
/* channelDescription= */ 0,
|
|
||||||
notificationId,
|
|
||||||
mediaDescriptionAdapter,
|
|
||||||
notificationListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@Deprecated
|
|
||||||
public static PlayerNotificationManager createWithNotificationChannel(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
@StringRes int channelName,
|
|
||||||
@StringRes int channelDescription,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter,
|
|
||||||
@Nullable NotificationListener notificationListener) {
|
|
||||||
NotificationUtil.createNotificationChannel(
|
|
||||||
context, channelId, channelName, channelDescription, NotificationUtil.IMPORTANCE_LOW);
|
|
||||||
return new PlayerNotificationManager(
|
|
||||||
context, channelId, notificationId, mediaDescriptionAdapter, notificationListener);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@Deprecated
|
|
||||||
public PlayerNotificationManager(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter) {
|
|
||||||
this(
|
|
||||||
context,
|
|
||||||
channelId,
|
|
||||||
notificationId,
|
|
||||||
mediaDescriptionAdapter,
|
|
||||||
/* notificationListener= */ null,
|
|
||||||
/* customActionReceiver */ null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@Deprecated
|
|
||||||
public PlayerNotificationManager(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter,
|
|
||||||
@Nullable NotificationListener notificationListener) {
|
|
||||||
this(
|
|
||||||
context,
|
|
||||||
channelId,
|
|
||||||
notificationId,
|
|
||||||
mediaDescriptionAdapter,
|
|
||||||
notificationListener,
|
|
||||||
/* customActionReceiver= */ null);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public PlayerNotificationManager(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter,
|
|
||||||
@Nullable CustomActionReceiver customActionReceiver) {
|
|
||||||
this(
|
|
||||||
context,
|
|
||||||
channelId,
|
|
||||||
notificationId,
|
|
||||||
mediaDescriptionAdapter,
|
|
||||||
/* notificationListener= */ null,
|
|
||||||
customActionReceiver);
|
|
||||||
}
|
|
||||||
|
|
||||||
/** @deprecated Use the {@link Builder} instead. */
|
|
||||||
@Deprecated
|
|
||||||
public PlayerNotificationManager(
|
|
||||||
Context context,
|
|
||||||
String channelId,
|
|
||||||
int notificationId,
|
|
||||||
MediaDescriptionAdapter mediaDescriptionAdapter,
|
|
||||||
@Nullable NotificationListener notificationListener,
|
|
||||||
@Nullable CustomActionReceiver customActionReceiver) {
|
|
||||||
this(
|
|
||||||
context,
|
|
||||||
channelId,
|
|
||||||
notificationId,
|
|
||||||
mediaDescriptionAdapter,
|
|
||||||
notificationListener,
|
|
||||||
customActionReceiver,
|
|
||||||
R.drawable.exo_notification_small_icon,
|
|
||||||
R.drawable.exo_notification_play,
|
|
||||||
R.drawable.exo_notification_pause,
|
|
||||||
R.drawable.exo_notification_stop,
|
|
||||||
R.drawable.exo_notification_rewind,
|
|
||||||
R.drawable.exo_notification_fastforward,
|
|
||||||
R.drawable.exo_notification_previous,
|
|
||||||
R.drawable.exo_notification_next,
|
|
||||||
null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private PlayerNotificationManager(
|
private PlayerNotificationManager(
|
||||||
Context context,
|
Context context,
|
||||||
String channelId,
|
String channelId,
|
||||||
@ -926,32 +779,6 @@ public class PlayerNotificationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)}.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public final void setFastForwardIncrementMs(long fastForwardMs) {
|
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
|
||||||
((DefaultControlDispatcher) controlDispatcher).setFastForwardIncrementMs(fastForwardMs);
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)}.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public final void setRewindIncrementMs(long rewindMs) {
|
|
||||||
if (controlDispatcher instanceof DefaultControlDispatcher) {
|
|
||||||
((DefaultControlDispatcher) controlDispatcher).setRewindIncrementMs(rewindMs);
|
|
||||||
invalidate();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the next action should be used.
|
* Sets whether the next action should be used.
|
||||||
*
|
*
|
||||||
@ -976,18 +803,6 @@ public class PlayerNotificationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Sets whether the navigation actions should be used.
|
|
||||||
*
|
|
||||||
* @param useNavigationActions Whether to use navigation actions.
|
|
||||||
* @deprecated Use {@link #setUseNextAction(boolean)} and {@link #setUsePreviousAction(boolean)}.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final void setUseNavigationActions(boolean useNavigationActions) {
|
|
||||||
setUseNextAction(useNavigationActions);
|
|
||||||
setUsePreviousAction(useNavigationActions);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If {@link #setUseNextAction useNextAction} is {@code true}, sets whether the next action should
|
* If {@link #setUseNextAction useNextAction} is {@code true}, sets whether the next action should
|
||||||
* also be used in compact view. Has no effect if {@link #setUseNextAction useNextAction} is
|
* also be used in compact view. Has no effect if {@link #setUseNextAction useNextAction} is
|
||||||
@ -1016,22 +831,6 @@ public class PlayerNotificationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* If {@link #setUseNavigationActions useNavigationActions} is {@code true}, sets whether
|
|
||||||
* navigation actions should also be used in compact view. Has no effect if {@link
|
|
||||||
* #setUseNavigationActions useNavigationActions} is {@code false}.
|
|
||||||
*
|
|
||||||
* @param useNavigationActionsInCompactView Whether to use navigation actions in compact view.
|
|
||||||
* @deprecated Use {@link #setUseNextActionInCompactView(boolean)} and {@link
|
|
||||||
* #setUsePreviousActionInCompactView(boolean)} instead.
|
|
||||||
*/
|
|
||||||
@Deprecated
|
|
||||||
public final void setUseNavigationActionsInCompactView(
|
|
||||||
boolean useNavigationActionsInCompactView) {
|
|
||||||
setUseNextActionInCompactView(useNavigationActionsInCompactView);
|
|
||||||
setUsePreviousActionInCompactView(useNavigationActionsInCompactView);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the play and pause actions should be used.
|
* Sets whether the play and pause actions should be used.
|
||||||
*
|
*
|
||||||
@ -1141,8 +940,8 @@ public class PlayerNotificationManager {
|
|||||||
* <p>See {@link NotificationCompat.Builder#setPriority(int)}.
|
* <p>See {@link NotificationCompat.Builder#setPriority(int)}.
|
||||||
*
|
*
|
||||||
* <p>To set the priority for API levels above 25, you can create your own {@link
|
* <p>To set the priority for API levels above 25, you can create your own {@link
|
||||||
* NotificationChannel} with a given importance level and pass the id of the channel to the {@link
|
* NotificationChannel} with a given importance level and pass the id of the channel to {@link
|
||||||
* #PlayerNotificationManager(Context, String, int, MediaDescriptionAdapter) constructor}.
|
* Builder#Builder(Context, int, String, MediaDescriptionAdapter)}.
|
||||||
*
|
*
|
||||||
* @param priority The priority which can be one of {@link NotificationCompat#PRIORITY_DEFAULT},
|
* @param priority The priority which can be one of {@link NotificationCompat#PRIORITY_DEFAULT},
|
||||||
* {@link NotificationCompat#PRIORITY_MAX}, {@link NotificationCompat#PRIORITY_HIGH}, {@link
|
* {@link NotificationCompat#PRIORITY_MAX}, {@link NotificationCompat#PRIORITY_HIGH}, {@link
|
||||||
|
@ -47,7 +47,6 @@ import androidx.annotation.RequiresApi;
|
|||||||
import androidx.core.content.ContextCompat;
|
import androidx.core.content.ContextCompat;
|
||||||
import com.google.android.exoplayer2.C;
|
import com.google.android.exoplayer2.C;
|
||||||
import com.google.android.exoplayer2.ControlDispatcher;
|
import com.google.android.exoplayer2.ControlDispatcher;
|
||||||
import com.google.android.exoplayer2.DefaultControlDispatcher;
|
|
||||||
import com.google.android.exoplayer2.ExoPlaybackException;
|
import com.google.android.exoplayer2.ExoPlaybackException;
|
||||||
import com.google.android.exoplayer2.Player;
|
import com.google.android.exoplayer2.Player;
|
||||||
import com.google.android.exoplayer2.Player.DiscontinuityReason;
|
import com.google.android.exoplayer2.Player.DiscontinuityReason;
|
||||||
@ -975,28 +974,6 @@ public class PlayerView extends FrameLayout implements AdViewProvider {
|
|||||||
controller.setShowNextButton(showNextButton);
|
controller.setShowNextButton(showNextButton);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)}.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public void setRewindIncrementMs(int rewindMs) {
|
|
||||||
Assertions.checkStateNotNull(controller);
|
|
||||||
controller.setRewindIncrementMs(rewindMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @deprecated Use {@link #setControlDispatcher(ControlDispatcher)} with {@link
|
|
||||||
* DefaultControlDispatcher#DefaultControlDispatcher(long, long)}.
|
|
||||||
*/
|
|
||||||
@SuppressWarnings("deprecation")
|
|
||||||
@Deprecated
|
|
||||||
public void setFastForwardIncrementMs(int fastForwardMs) {
|
|
||||||
Assertions.checkStateNotNull(controller);
|
|
||||||
controller.setFastForwardIncrementMs(fastForwardMs);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets which repeat toggle modes are enabled.
|
* Sets which repeat toggle modes are enabled.
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user