PlayerNotificationManager: add setUseRewind/FastForwardAction
This is a preliminary step to deprecate ControlDispatcher. PiperOrigin-RevId: 385097270
This commit is contained in:
parent
78ecb10ac0
commit
227f9a3b93
@ -88,6 +88,8 @@
|
|||||||
* Don't propagate `AttributeSet` from `SubtitleView` constructor into
|
* Don't propagate `AttributeSet` from `SubtitleView` constructor into
|
||||||
`CanvasSubtitleOutput`. Just passing the `Context` is enough, and
|
`CanvasSubtitleOutput`. Just passing the `Context` is enough, and
|
||||||
ensures programmatic changes to the `SubtitleView` will propagate down.
|
ensures programmatic changes to the `SubtitleView` will propagate down.
|
||||||
|
* Add `setUseRewindAction` and `setUseFastForwardAction` to
|
||||||
|
`PlayerNotificationManager`.
|
||||||
* Video:
|
* Video:
|
||||||
* Fix `IncorrectContextUseViolation` strict mode warning on Android 11
|
* Fix `IncorrectContextUseViolation` strict mode warning on Android 11
|
||||||
([#8246](https://github.com/google/ExoPlayer/pull/8246)).
|
([#8246](https://github.com/google/ExoPlayer/pull/8246)).
|
||||||
|
@ -86,26 +86,26 @@ import java.util.Map;
|
|||||||
* <li>Corresponding setter: {@link #setUsePlayPauseActions(boolean)}
|
* <li>Corresponding setter: {@link #setUsePlayPauseActions(boolean)}
|
||||||
* <li>Default: {@code true}
|
* <li>Default: {@code true}
|
||||||
* </ul>
|
* </ul>
|
||||||
* <li><b>{@code rewindIncrementMs}</b> - Sets the rewind increment. If set to zero the rewind
|
* <li><b>{@code useRewindAction}</b> - Sets whether the rewind action is used.
|
||||||
* action is not used.
|
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Corresponding setter: {@link #setControlDispatcher(ControlDispatcher)}
|
* <li>Corresponding setter: {@link #setUseRewindAction(boolean)}
|
||||||
* <li>Default: {@link DefaultControlDispatcher#DEFAULT_REWIND_MS} (5000)
|
* <li>Default: {@code true}
|
||||||
* </ul>
|
* </ul>
|
||||||
* <li><b>{@code useRewindActionInCompactView}</b> - Sets whether the rewind action should be
|
* <li><b>{@code useRewindActionInCompactView}</b> - If {@code useRewindAction} is {@code true},
|
||||||
* shown in compact view mode.
|
* sets whether the rewind action is also used in compact view (including the lock screen
|
||||||
|
* notification). Else does nothing.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Corresponding setter: {@link #setUseRewindActionInCompactView(boolean)}
|
* <li>Corresponding setter: {@link #setUseRewindActionInCompactView(boolean)}
|
||||||
* <li>Default: {@code false}
|
* <li>Default: {@code false}
|
||||||
* </ul>
|
* </ul>
|
||||||
* <li><b>{@code fastForwardIncrementMs}</b> - Sets the fast forward increment. If set to zero the
|
* <li><b>{@code useFastForwardAction}</b> - Sets whether the fast forward action is used.
|
||||||
* fast forward action is not used.
|
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Corresponding setter: {@link #setControlDispatcher(ControlDispatcher)}
|
* <li>Corresponding setter: {@link #setUseFastForwardAction(boolean)}
|
||||||
* <li>Default: {@link DefaultControlDispatcher#DEFAULT_FAST_FORWARD_MS} (15000)
|
* <li>Default: {@code true}
|
||||||
* </ul>
|
* </ul>
|
||||||
* <li><b>{@code useFastForwardActionInCompactView}</b> - Sets whether the fast forward action
|
* <li><b>{@code useFastForwardActionInCompactView}</b> - If {@code useFastForwardAction} is
|
||||||
* should be shown in compact view mode.
|
* {@code true}, sets whether the fast forward action is also used in compact view (including
|
||||||
|
* the lock screen notification). Else does nothing.
|
||||||
* <ul>
|
* <ul>
|
||||||
* <li>Corresponding setter: {@link #setUseFastForwardActionInCompactView(boolean)}
|
* <li>Corresponding setter: {@link #setUseFastForwardActionInCompactView(boolean)}
|
||||||
* <li>Default: {@code false}
|
* <li>Default: {@code false}
|
||||||
@ -689,6 +689,8 @@ public class PlayerNotificationManager {
|
|||||||
private boolean useNextAction;
|
private boolean useNextAction;
|
||||||
private boolean usePreviousActionInCompactView;
|
private boolean usePreviousActionInCompactView;
|
||||||
private boolean useNextActionInCompactView;
|
private boolean useNextActionInCompactView;
|
||||||
|
private boolean useRewindAction;
|
||||||
|
private boolean useFastForwardAction;
|
||||||
private boolean useRewindActionInCompactView;
|
private boolean useRewindActionInCompactView;
|
||||||
private boolean useFastForwardActionInCompactView;
|
private boolean useFastForwardActionInCompactView;
|
||||||
private boolean usePlayPauseActions;
|
private boolean usePlayPauseActions;
|
||||||
@ -743,6 +745,8 @@ public class PlayerNotificationManager {
|
|||||||
usePreviousAction = true;
|
usePreviousAction = true;
|
||||||
useNextAction = true;
|
useNextAction = true;
|
||||||
usePlayPauseActions = true;
|
usePlayPauseActions = true;
|
||||||
|
useRewindAction = true;
|
||||||
|
useFastForwardAction = true;
|
||||||
colorized = true;
|
colorized = true;
|
||||||
useChronometer = true;
|
useChronometer = true;
|
||||||
color = Color.TRANSPARENT;
|
color = Color.TRANSPARENT;
|
||||||
@ -886,6 +890,30 @@ public class PlayerNotificationManager {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the fast forward action should be used.
|
||||||
|
*
|
||||||
|
* @param useFastForwardAction Whether to use the fast forward action.
|
||||||
|
*/
|
||||||
|
public void setUseFastForwardAction(boolean useFastForwardAction) {
|
||||||
|
if (this.useFastForwardAction != useFastForwardAction) {
|
||||||
|
this.useFastForwardAction = useFastForwardAction;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets whether the rewind action should be used.
|
||||||
|
*
|
||||||
|
* @param useRewindAction Whether to use the rewind action.
|
||||||
|
*/
|
||||||
|
public void setUseRewindAction(boolean useRewindAction) {
|
||||||
|
if (this.useRewindAction != useRewindAction) {
|
||||||
|
this.useRewindAction = useRewindAction;
|
||||||
|
invalidate();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Sets whether the fast forward action should also be used in compact view. Has no effect if
|
* Sets whether the fast forward action should also be used in compact view. Has no effect if
|
||||||
* {@link #ACTION_FAST_FORWARD} is not enabled, for instance if the media is not seekable.
|
* {@link #ACTION_FAST_FORWARD} is not enabled, for instance if the media is not seekable.
|
||||||
@ -1300,7 +1328,7 @@ public class PlayerNotificationManager {
|
|||||||
if (usePreviousAction && enablePrevious) {
|
if (usePreviousAction && enablePrevious) {
|
||||||
stringActions.add(ACTION_PREVIOUS);
|
stringActions.add(ACTION_PREVIOUS);
|
||||||
}
|
}
|
||||||
if (enableRewind) {
|
if (useRewindAction && enableRewind) {
|
||||||
stringActions.add(ACTION_REWIND);
|
stringActions.add(ACTION_REWIND);
|
||||||
}
|
}
|
||||||
if (usePlayPauseActions) {
|
if (usePlayPauseActions) {
|
||||||
@ -1310,7 +1338,7 @@ public class PlayerNotificationManager {
|
|||||||
stringActions.add(ACTION_PLAY);
|
stringActions.add(ACTION_PLAY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (enableFastForward) {
|
if (useFastForwardAction && enableFastForward) {
|
||||||
stringActions.add(ACTION_FAST_FORWARD);
|
stringActions.add(ACTION_FAST_FORWARD);
|
||||||
}
|
}
|
||||||
if (useNextAction && enableNext) {
|
if (useNextAction && enableNext) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user