mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +00:00
allow an app to force an update of the player notification
Issue:#4379 ------------- Created by MOE: https://github.com/google/moe MOE_MIGRATED_REVID=201497585
This commit is contained in:
parent
38096fb734
commit
10690630bf
1 changed files with 22 additions and 21 deletions
|
|
@ -460,7 +460,7 @@ public class PlayerNotificationManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.fastForwardMs = fastForwardMs;
|
this.fastForwardMs = fastForwardMs;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -474,7 +474,7 @@ public class PlayerNotificationManager {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.rewindMs = rewindMs;
|
this.rewindMs = rewindMs;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -485,7 +485,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setUseNavigationActions(boolean useNavigationActions) {
|
public final void setUseNavigationActions(boolean useNavigationActions) {
|
||||||
if (this.useNavigationActions != useNavigationActions) {
|
if (this.useNavigationActions != useNavigationActions) {
|
||||||
this.useNavigationActions = useNavigationActions;
|
this.useNavigationActions = useNavigationActions;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -497,7 +497,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setUsePlayPauseActions(boolean usePlayPauseActions) {
|
public final void setUsePlayPauseActions(boolean usePlayPauseActions) {
|
||||||
if (this.usePlayPauseActions != usePlayPauseActions) {
|
if (this.usePlayPauseActions != usePlayPauseActions) {
|
||||||
this.usePlayPauseActions = usePlayPauseActions;
|
this.usePlayPauseActions = usePlayPauseActions;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -520,7 +520,7 @@ public class PlayerNotificationManager {
|
||||||
} else {
|
} else {
|
||||||
stopPendingIntent = null;
|
stopPendingIntent = null;
|
||||||
}
|
}
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -531,7 +531,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setMediaSessionToken(MediaSessionCompat.Token token) {
|
public final void setMediaSessionToken(MediaSessionCompat.Token token) {
|
||||||
if (!Util.areEqual(this.mediaSessionToken, token)) {
|
if (!Util.areEqual(this.mediaSessionToken, token)) {
|
||||||
mediaSessionToken = token;
|
mediaSessionToken = token;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -555,7 +555,7 @@ public class PlayerNotificationManager {
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -569,7 +569,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setColorized(boolean colorized) {
|
public final void setColorized(boolean colorized) {
|
||||||
if (this.colorized != colorized) {
|
if (this.colorized != colorized) {
|
||||||
this.colorized = colorized;
|
this.colorized = colorized;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -583,7 +583,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setDefaults(int defaults) {
|
public final void setDefaults(int defaults) {
|
||||||
if (this.defaults != defaults) {
|
if (this.defaults != defaults) {
|
||||||
this.defaults = defaults;
|
this.defaults = defaults;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -597,7 +597,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setColor(int color) {
|
public final void setColor(int color) {
|
||||||
if (this.color != color) {
|
if (this.color != color) {
|
||||||
this.color = color;
|
this.color = color;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -613,7 +613,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setOngoing(boolean ongoing) {
|
public final void setOngoing(boolean ongoing) {
|
||||||
if (this.ongoing != ongoing) {
|
if (this.ongoing != ongoing) {
|
||||||
this.ongoing = ongoing;
|
this.ongoing = ongoing;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -642,7 +642,7 @@ public class PlayerNotificationManager {
|
||||||
default:
|
default:
|
||||||
throw new IllegalArgumentException();
|
throw new IllegalArgumentException();
|
||||||
}
|
}
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
@ -655,7 +655,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setSmallIcon(@DrawableRes int smallIconResourceId) {
|
public final void setSmallIcon(@DrawableRes int smallIconResourceId) {
|
||||||
if (this.smallIconResourceId != smallIconResourceId) {
|
if (this.smallIconResourceId != smallIconResourceId) {
|
||||||
this.smallIconResourceId = smallIconResourceId;
|
this.smallIconResourceId = smallIconResourceId;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -669,7 +669,7 @@ public class PlayerNotificationManager {
|
||||||
public final void setUseChronometer(boolean useChronometer) {
|
public final void setUseChronometer(boolean useChronometer) {
|
||||||
if (this.useChronometer != useChronometer) {
|
if (this.useChronometer != useChronometer) {
|
||||||
this.useChronometer = useChronometer;
|
this.useChronometer = useChronometer;
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -696,7 +696,14 @@ public class PlayerNotificationManager {
|
||||||
default:
|
default:
|
||||||
throw new IllegalStateException();
|
throw new IllegalStateException();
|
||||||
}
|
}
|
||||||
maybeUpdateNotification();
|
invalidate();
|
||||||
|
}
|
||||||
|
|
||||||
|
/** Forces an update of the notification if already started. */
|
||||||
|
public void invalidate() {
|
||||||
|
if (isNotificationStarted && player != null) {
|
||||||
|
updateNotification(null);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@RequiresNonNull("player")
|
@RequiresNonNull("player")
|
||||||
|
|
@ -719,12 +726,6 @@ public class PlayerNotificationManager {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void maybeUpdateNotification() {
|
|
||||||
if (isNotificationStarted && player != null) {
|
|
||||||
updateNotification(null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void stopNotification() {
|
private void stopNotification() {
|
||||||
if (isNotificationStarted) {
|
if (isNotificationStarted) {
|
||||||
notificationManager.cancel(notificationId);
|
notificationManager.cancel(notificationId);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue