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
15c3c44e
authored
Feb 24, 2021
by
olly
Committed by
kim-vde
Feb 25, 2021
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
Add group setting for the notification
PiperOrigin-RevId: 359298960
parent
a5424ace
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
3 deletions
RELEASENOTES.md
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java
RELEASENOTES.md
View file @
15c3c44e
...
@@ -6,6 +6,7 @@
...
@@ -6,6 +6,7 @@
*
Add support for MP4 and QuickTime meta atoms that are not full atoms.
*
Add support for MP4 and QuickTime meta atoms that are not full atoms.
*
UI:
*
UI:
*
Add builder for
`PlayerNotificationManager`
.
*
Add builder for
`PlayerNotificationManager`
.
*
Add group setting to
`PlayerNotificationManager`
.
*
Make conditions to enable UI actions consistent in
*
Make conditions to enable UI actions consistent in
`DefaultControlDispatcher`
,
`PlayerControlView`
,
`DefaultControlDispatcher`
,
`PlayerControlView`
,
`StyledPlayerControlView`
,
`PlayerNotificationManager`
and
`StyledPlayerControlView`
,
`PlayerNotificationManager`
and
...
...
library/ui/src/main/java/com/google/android/exoplayer2/ui/PlayerNotificationManager.java
View file @
15c3c44e
...
@@ -320,6 +320,7 @@ public class PlayerNotificationManager {
...
@@ -320,6 +320,7 @@ public class PlayerNotificationManager {
private
int
fastForwardActionIconResourceId
;
private
int
fastForwardActionIconResourceId
;
private
int
previousActionIconResourceId
;
private
int
previousActionIconResourceId
;
private
int
nextActionIconResourceId
;
private
int
nextActionIconResourceId
;
@Nullable
private
String
groupKey
;
/**
/**
* Creates an instance.
* Creates an instance.
...
@@ -514,6 +515,18 @@ public class PlayerNotificationManager {
...
@@ -514,6 +515,18 @@ public class PlayerNotificationManager {
return
this
;
return
this
;
}
}
/**
* The key of the group the media notification should belong to.
*
* <p>The default is {@code null}
*
* @return This builder.
*/
public
Builder
setGroup
(
String
groupKey
)
{
this
.
groupKey
=
groupKey
;
return
this
;
}
/** Builds the {@link PlayerNotificationManager}. */
/** Builds the {@link PlayerNotificationManager}. */
public
PlayerNotificationManager
build
()
{
public
PlayerNotificationManager
build
()
{
if
(
channelNameResourceId
!=
0
)
{
if
(
channelNameResourceId
!=
0
)
{
...
@@ -538,7 +551,8 @@ public class PlayerNotificationManager {
...
@@ -538,7 +551,8 @@ public class PlayerNotificationManager {
rewindActionIconResourceId
,
rewindActionIconResourceId
,
fastForwardActionIconResourceId
,
fastForwardActionIconResourceId
,
previousActionIconResourceId
,
previousActionIconResourceId
,
nextActionIconResourceId
);
nextActionIconResourceId
,
groupKey
);
}
}
}
}
...
@@ -662,6 +676,7 @@ public class PlayerNotificationManager {
...
@@ -662,6 +676,7 @@ public class PlayerNotificationManager {
private
int
visibility
;
private
int
visibility
;
@Priority
private
int
priority
;
@Priority
private
int
priority
;
private
boolean
useChronometer
;
private
boolean
useChronometer
;
@Nullable
private
String
groupKey
;
/** @deprecated Use the {@link Builder} instead. */
/** @deprecated Use the {@link Builder} instead. */
@SuppressWarnings
(
"deprecation"
)
@SuppressWarnings
(
"deprecation"
)
...
@@ -805,7 +820,8 @@ public class PlayerNotificationManager {
...
@@ -805,7 +820,8 @@ public class PlayerNotificationManager {
R
.
drawable
.
exo_notification_rewind
,
R
.
drawable
.
exo_notification_rewind
,
R
.
drawable
.
exo_notification_fastforward
,
R
.
drawable
.
exo_notification_fastforward
,
R
.
drawable
.
exo_notification_previous
,
R
.
drawable
.
exo_notification_previous
,
R
.
drawable
.
exo_notification_next
);
R
.
drawable
.
exo_notification_next
,
null
);
}
}
private
PlayerNotificationManager
(
private
PlayerNotificationManager
(
...
@@ -822,7 +838,8 @@ public class PlayerNotificationManager {
...
@@ -822,7 +838,8 @@ public class PlayerNotificationManager {
int
rewindActionIconResourceId
,
int
rewindActionIconResourceId
,
int
fastForwardActionIconResourceId
,
int
fastForwardActionIconResourceId
,
int
previousActionIconResourceId
,
int
previousActionIconResourceId
,
int
nextActionIconResourceId
)
{
int
nextActionIconResourceId
,
@Nullable
String
groupKey
)
{
context
=
context
.
getApplicationContext
();
context
=
context
.
getApplicationContext
();
this
.
context
=
context
;
this
.
context
=
context
;
this
.
channelId
=
channelId
;
this
.
channelId
=
channelId
;
...
@@ -831,6 +848,7 @@ public class PlayerNotificationManager {
...
@@ -831,6 +848,7 @@ public class PlayerNotificationManager {
this
.
notificationListener
=
notificationListener
;
this
.
notificationListener
=
notificationListener
;
this
.
customActionReceiver
=
customActionReceiver
;
this
.
customActionReceiver
=
customActionReceiver
;
this
.
smallIconResourceId
=
smallIconResourceId
;
this
.
smallIconResourceId
=
smallIconResourceId
;
this
.
groupKey
=
groupKey
;
controlDispatcher
=
new
DefaultControlDispatcher
();
controlDispatcher
=
new
DefaultControlDispatcher
();
window
=
new
Timeline
.
Window
();
window
=
new
Timeline
.
Window
();
instanceId
=
instanceIdCounter
++;
instanceId
=
instanceIdCounter
++;
...
@@ -1407,6 +1425,10 @@ public class PlayerNotificationManager {
...
@@ -1407,6 +1425,10 @@ public class PlayerNotificationManager {
setLargeIcon
(
builder
,
largeIcon
);
setLargeIcon
(
builder
,
largeIcon
);
builder
.
setContentIntent
(
mediaDescriptionAdapter
.
createCurrentContentIntent
(
player
));
builder
.
setContentIntent
(
mediaDescriptionAdapter
.
createCurrentContentIntent
(
player
));
if
(
groupKey
!=
null
)
{
builder
.
setGroup
(
groupKey
);
}
return
builder
;
return
builder
;
}
}
...
...
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