Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
SDK
/
exoplayer
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
21bbdb58
authored
Dec 06, 2021
by
jaewan
Committed by
Ian Baker
Dec 07, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Remove built-in support for stop() in Notification
PiperOrigin-RevId: 414321900
parent
8bd5d8bc
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
4 additions
and
86 deletions
libraries/session/src/main/java/androidx/media3/session/PlayerNotificationManager.java
libraries/session/src/main/res/drawable/exo_icon_stop.xml
libraries/session/src/main/res/values/drawables.xml
libraries/session/src/main/res/values/strings.xml
libraries/session/src/main/java/androidx/media3/session/PlayerNotificationManager.java
View file @
21bbdb58
...
@@ -134,11 +134,6 @@ import java.util.Map;
...
@@ -134,11 +134,6 @@ import java.util.Map;
* <li>Corresponding setter: {@link #setUseNextActionInCompactView(boolean)}
* <li>Corresponding setter: {@link #setUseNextActionInCompactView(boolean)}
* <li>Default: {@code false}
* <li>Default: {@code false}
* </ul>
* </ul>
* <li><b>{@code useStopAction}</b> - Sets whether the stop action is used.
* <ul>
* <li>Corresponding setter: {@link #setUseStopAction(boolean)}
* <li>Default: {@code false}
* </ul>
* </ul>
* </ul>
*
*
* <h2>Overriding drawables</h2>
* <h2>Overriding drawables</h2>
...
@@ -156,7 +151,6 @@ import java.util.Map;
...
@@ -156,7 +151,6 @@ import java.util.Map;
* <li><b>{@code exo_notification_fastforward}</b> - The fast forward icon.
* <li><b>{@code exo_notification_fastforward}</b> - The fast forward icon.
* <li><b>{@code exo_notification_previous}</b> - The previous icon.
* <li><b>{@code exo_notification_previous}</b> - The previous icon.
* <li><b>{@code exo_notification_next}</b> - The next icon.
* <li><b>{@code exo_notification_next}</b> - The next icon.
* <li><b>{@code exo_notification_stop}</b> - The stop icon.
* </ul>
* </ul>
*
*
* <p>Alternatively, the action icons can be set programatically by using the {@link Builder}.
* <p>Alternatively, the action icons can be set programatically by using the {@link Builder}.
...
@@ -320,7 +314,6 @@ public class PlayerNotificationManager {
...
@@ -320,7 +314,6 @@ public class PlayerNotificationManager {
protected
int
rewindActionIconResourceId
;
protected
int
rewindActionIconResourceId
;
protected
int
playActionIconResourceId
;
protected
int
playActionIconResourceId
;
protected
int
pauseActionIconResourceId
;
protected
int
pauseActionIconResourceId
;
protected
int
stopActionIconResourceId
;
protected
int
fastForwardActionIconResourceId
;
protected
int
fastForwardActionIconResourceId
;
protected
int
previousActionIconResourceId
;
protected
int
previousActionIconResourceId
;
protected
int
nextActionIconResourceId
;
protected
int
nextActionIconResourceId
;
...
@@ -357,7 +350,6 @@ public class PlayerNotificationManager {
...
@@ -357,7 +350,6 @@ public class PlayerNotificationManager {
smallIconResourceId
=
R
.
drawable
.
exo_notification_small_icon
;
smallIconResourceId
=
R
.
drawable
.
exo_notification_small_icon
;
playActionIconResourceId
=
R
.
drawable
.
exo_notification_play
;
playActionIconResourceId
=
R
.
drawable
.
exo_notification_play
;
pauseActionIconResourceId
=
R
.
drawable
.
exo_notification_pause
;
pauseActionIconResourceId
=
R
.
drawable
.
exo_notification_pause
;
stopActionIconResourceId
=
R
.
drawable
.
exo_notification_stop
;
rewindActionIconResourceId
=
R
.
drawable
.
exo_notification_rewind
;
rewindActionIconResourceId
=
R
.
drawable
.
exo_notification_rewind
;
fastForwardActionIconResourceId
=
R
.
drawable
.
exo_notification_fastforward
;
fastForwardActionIconResourceId
=
R
.
drawable
.
exo_notification_fastforward
;
previousActionIconResourceId
=
R
.
drawable
.
exo_notification_previous
;
previousActionIconResourceId
=
R
.
drawable
.
exo_notification_previous
;
...
@@ -468,18 +460,6 @@ public class PlayerNotificationManager {
...
@@ -468,18 +460,6 @@ public class PlayerNotificationManager {
}
}
/**
/**
* The resource id of the drawable to be used as the icon of action {@link #ACTION_STOP}.
*
* <p>The default is {@code R.drawable#exo_notification_stop}.
*
* @return This builder.
*/
public
Builder
setStopActionIconResourceId
(
int
stopActionIconResourceId
)
{
this
.
stopActionIconResourceId
=
stopActionIconResourceId
;
return
this
;
}
/**
* The resource id of the drawable to be used as the icon of action {@link #ACTION_REWIND}.
* The resource id of the drawable to be used as the icon of action {@link #ACTION_REWIND}.
*
*
* <p>The default is {@code R.drawable#exo_notification_rewind}.
* <p>The default is {@code R.drawable#exo_notification_rewind}.
...
@@ -573,7 +553,6 @@ public class PlayerNotificationManager {
...
@@ -573,7 +553,6 @@ public class PlayerNotificationManager {
smallIconResourceId
,
smallIconResourceId
,
playActionIconResourceId
,
playActionIconResourceId
,
pauseActionIconResourceId
,
pauseActionIconResourceId
,
stopActionIconResourceId
,
rewindActionIconResourceId
,
rewindActionIconResourceId
,
fastForwardActionIconResourceId
,
fastForwardActionIconResourceId
,
previousActionIconResourceId
,
previousActionIconResourceId
,
...
@@ -615,8 +594,6 @@ public class PlayerNotificationManager {
...
@@ -615,8 +594,6 @@ public class PlayerNotificationManager {
public
static
final
String
ACTION_FAST_FORWARD
=
"androidx.media3.ui.notification.ffwd"
;
public
static
final
String
ACTION_FAST_FORWARD
=
"androidx.media3.ui.notification.ffwd"
;
/** The action which rewinds. */
/** The action which rewinds. */
public
static
final
String
ACTION_REWIND
=
"androidx.media3.ui.notification.rewind"
;
public
static
final
String
ACTION_REWIND
=
"androidx.media3.ui.notification.rewind"
;
/** The action which stops playback. */
public
static
final
String
ACTION_STOP
=
"androidx.media3.ui.notification.stop"
;
/** The extra key of the instance id of the player notification manager. */
/** The extra key of the instance id of the player notification manager. */
public
static
final
String
EXTRA_INSTANCE_ID
=
"INSTANCE_ID"
;
public
static
final
String
EXTRA_INSTANCE_ID
=
"INSTANCE_ID"
;
/**
/**
...
@@ -694,7 +671,6 @@ public class PlayerNotificationManager {
...
@@ -694,7 +671,6 @@ public class PlayerNotificationManager {
private
boolean
useRewindActionInCompactView
;
private
boolean
useRewindActionInCompactView
;
private
boolean
useFastForwardActionInCompactView
;
private
boolean
useFastForwardActionInCompactView
;
private
boolean
usePlayPauseActions
;
private
boolean
usePlayPauseActions
;
private
boolean
useStopAction
;
private
int
badgeIconType
;
private
int
badgeIconType
;
private
boolean
colorized
;
private
boolean
colorized
;
private
int
defaults
;
private
int
defaults
;
...
@@ -715,7 +691,6 @@ public class PlayerNotificationManager {
...
@@ -715,7 +691,6 @@ public class PlayerNotificationManager {
int
smallIconResourceId
,
int
smallIconResourceId
,
int
playActionIconResourceId
,
int
playActionIconResourceId
,
int
pauseActionIconResourceId
,
int
pauseActionIconResourceId
,
int
stopActionIconResourceId
,
int
rewindActionIconResourceId
,
int
rewindActionIconResourceId
,
int
fastForwardActionIconResourceId
,
int
fastForwardActionIconResourceId
,
int
previousActionIconResourceId
,
int
previousActionIconResourceId
,
...
@@ -761,7 +736,6 @@ public class PlayerNotificationManager {
...
@@ -761,7 +736,6 @@ public class PlayerNotificationManager {
instanceId
,
instanceId
,
playActionIconResourceId
,
playActionIconResourceId
,
pauseActionIconResourceId
,
pauseActionIconResourceId
,
stopActionIconResourceId
,
rewindActionIconResourceId
,
rewindActionIconResourceId
,
fastForwardActionIconResourceId
,
fastForwardActionIconResourceId
,
previousActionIconResourceId
,
previousActionIconResourceId
,
...
@@ -954,19 +928,6 @@ public class PlayerNotificationManager {
...
@@ -954,19 +928,6 @@ public class PlayerNotificationManager {
}
}
/**
/**
* Sets whether the stop action should be used.
*
* @param useStopAction Whether to use the stop action.
*/
public
final
void
setUseStopAction
(
boolean
useStopAction
)
{
if
(
this
.
useStopAction
==
useStopAction
)
{
return
;
}
this
.
useStopAction
=
useStopAction
;
invalidate
();
}
/**
* Sets the {@link MediaSessionCompat.Token}.
* Sets the {@link MediaSessionCompat.Token}.
*
*
* @param token The {@link MediaSessionCompat.Token}.
* @param token The {@link MediaSessionCompat.Token}.
...
@@ -1293,9 +1254,9 @@ public class PlayerNotificationManager {
...
@@ -1293,9 +1254,9 @@ public class PlayerNotificationManager {
* omitted:
* omitted:
*
*
* <pre>
* <pre>
* +-----------------------------------------------------------------
-------
+
* +-----------------------------------------------------------------+
* | prev | << | play/pause | >> | next | custom actions |
stop |
* | prev | << | play/pause | >> | next | custom actions |
* +-----------------------------------------------------------------
-------
+
* +-----------------------------------------------------------------+
* </pre>
* </pre>
*
*
* <p>This method can be safely overridden. However, the names must be of the playback actions
* <p>This method can be safely overridden. However, the names must be of the playback actions
...
@@ -1333,9 +1294,6 @@ public class PlayerNotificationManager {
...
@@ -1333,9 +1294,6 @@ public class PlayerNotificationManager {
if
(
customActionReceiver
!=
null
)
{
if
(
customActionReceiver
!=
null
)
{
stringActions
.
addAll
(
customActionReceiver
.
getCustomActions
(
player
));
stringActions
.
addAll
(
customActionReceiver
.
getCustomActions
(
player
));
}
}
if
(
useStopAction
)
{
stringActions
.
add
(
ACTION_STOP
);
}
return
stringActions
;
return
stringActions
;
}
}
...
@@ -1427,7 +1385,6 @@ public class PlayerNotificationManager {
...
@@ -1427,7 +1385,6 @@ public class PlayerNotificationManager {
int
instanceId
,
int
instanceId
,
int
playActionIconResourceId
,
int
playActionIconResourceId
,
int
pauseActionIconResourceId
,
int
pauseActionIconResourceId
,
int
stopActionIconResourceId
,
int
rewindActionIconResourceId
,
int
rewindActionIconResourceId
,
int
fastForwardActionIconResourceId
,
int
fastForwardActionIconResourceId
,
int
previousActionIconResourceId
,
int
previousActionIconResourceId
,
...
@@ -1446,12 +1403,6 @@ public class PlayerNotificationManager {
...
@@ -1446,12 +1403,6 @@ public class PlayerNotificationManager {
context
.
getString
(
R
.
string
.
exo_controls_pause_description
),
context
.
getString
(
R
.
string
.
exo_controls_pause_description
),
createBroadcastIntent
(
ACTION_PAUSE
,
context
,
instanceId
)));
createBroadcastIntent
(
ACTION_PAUSE
,
context
,
instanceId
)));
actions
.
put
(
actions
.
put
(
ACTION_STOP
,
new
NotificationCompat
.
Action
(
stopActionIconResourceId
,
context
.
getString
(
R
.
string
.
exo_controls_stop_description
),
createBroadcastIntent
(
ACTION_STOP
,
context
,
instanceId
)));
actions
.
put
(
ACTION_REWIND
,
ACTION_REWIND
,
new
NotificationCompat
.
Action
(
new
NotificationCompat
.
Action
(
rewindActionIconResourceId
,
rewindActionIconResourceId
,
...
@@ -1546,8 +1497,6 @@ public class PlayerNotificationManager {
...
@@ -1546,8 +1497,6 @@ public class PlayerNotificationManager {
player
.
seekForward
();
player
.
seekForward
();
}
else
if
(
ACTION_NEXT
.
equals
(
action
))
{
}
else
if
(
ACTION_NEXT
.
equals
(
action
))
{
player
.
seekToNext
();
player
.
seekToNext
();
}
else
if
(
ACTION_STOP
.
equals
(
action
))
{
player
.
stop
(
/* reset= */
true
);
}
else
if
(
ACTION_DISMISS
.
equals
(
action
))
{
}
else
if
(
ACTION_DISMISS
.
equals
(
action
))
{
stopNotification
(
/* dismissedByUser= */
true
);
stopNotification
(
/* dismissedByUser= */
true
);
}
else
if
(
action
!=
null
}
else
if
(
action
!=
null
...
...
libraries/session/src/main/res/drawable/exo_icon_stop.xml
deleted
100644 → 0
View file @
8bd5d8bc
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright 2021 The Android Open Source Project
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<vector
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:width=
"24dp"
android:height=
"24dp"
android:viewportWidth=
"24"
android:viewportHeight=
"24"
>
<path
android:pathData=
"M0 0h24v24H0z"
/>
<path
android:fillColor=
"#000000"
android:pathData=
"M6 6h12v12H6z"
/>
</vector>
libraries/session/src/main/res/values/drawables.xml
View file @
21bbdb58
...
@@ -20,6 +20,5 @@
...
@@ -20,6 +20,5 @@
<drawable
name=
"exo_notification_previous"
>
@drawable/exo_icon_previous
</drawable>
<drawable
name=
"exo_notification_previous"
>
@drawable/exo_icon_previous
</drawable>
<drawable
name=
"exo_notification_fastforward"
>
@drawable/exo_icon_fastforward
</drawable>
<drawable
name=
"exo_notification_fastforward"
>
@drawable/exo_icon_fastforward
</drawable>
<drawable
name=
"exo_notification_rewind"
>
@drawable/exo_icon_rewind
</drawable>
<drawable
name=
"exo_notification_rewind"
>
@drawable/exo_icon_rewind
</drawable>
<drawable
name=
"exo_notification_stop"
>
@drawable/exo_icon_stop
</drawable>
<drawable
name=
"exo_notification_small_icon"
>
@drawable/exo_icon_circular_play
</drawable>
<drawable
name=
"exo_notification_small_icon"
>
@drawable/exo_icon_circular_play
</drawable>
</resources>
</resources>
libraries/session/src/main/res/values/strings.xml
View file @
21bbdb58
...
@@ -36,10 +36,8 @@
...
@@ -36,10 +36,8 @@
<string
name=
"exo_controls_pause_description"
>
Pause
</string>
<string
name=
"exo_controls_pause_description"
>
Pause
</string>
<!-- Description for a media control button that causes playback to be started. [CHAR LIMIT=30] -->
<!-- Description for a media control button that causes playback to be started. [CHAR LIMIT=30] -->
<string
name=
"exo_controls_play_description"
>
Play
</string>
<string
name=
"exo_controls_play_description"
>
Play
</string>
<!-- Description for a media control button that causes playback to be stopped. [CHAR LIMIT=30] -->
<string
name=
"exo_controls_stop_description"
>
Stop
</string>
<!-- Description for a media control button that causes playback to be rewound. [CHAR LIMIT=30] -->
<!-- Description for a media control button that causes playback to be rewound. [CHAR LIMIT=30] -->
<string
name=
"exo_controls_rewind_description"
>
Rewind
</string>
<string
name=
"exo_controls_rewind_description"
>
Rewind
</string>
<!-- Description for a media control button that causes playback to be fast-forwarded. [CHAR LIMIT=30] -->
<!-- Description for a media control button that causes playback to be fast-forwarded. [CHAR LIMIT=30] -->
<string
name=
"exo_controls_fastforward_description"
>
Fast forward
</string>
<string
name=
"exo_controls_fastforward_description"
>
Fast forward
</string>
</resources>
</resources>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment