Add group setting for the notification
PiperOrigin-RevId: 359298960
This commit is contained in:
parent
a5424acede
commit
15c3c44e64
@ -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
|
||||||
|
@ -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 {
|
|||||||
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 {
|
|||||||
rewindActionIconResourceId,
|
rewindActionIconResourceId,
|
||||||
fastForwardActionIconResourceId,
|
fastForwardActionIconResourceId,
|
||||||
previousActionIconResourceId,
|
previousActionIconResourceId,
|
||||||
nextActionIconResourceId);
|
nextActionIconResourceId,
|
||||||
|
groupKey);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -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 {
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
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 {
|
|||||||
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user