Add Already playing in background toast

This commit is contained in:
vhouriet 2021-12-22 12:36:26 +01:00
parent 19dd9d266a
commit 989bcbf895
2 changed files with 10 additions and 3 deletions

View file

@ -168,10 +168,16 @@ public final class NavigationHelper {
public static void playOnBackgroundPlayer(final Context context,
final PlayQueue queue,
final boolean resumePlayback) {
if (PlayerHolder.getInstance().getType() != MainPlayer.PlayerType.AUDIO) {
Toast.makeText(context, R.string.background_player_playing_toast, Toast.LENGTH_SHORT)
.show();
final int toastText;
if (PlayerHolder.getInstance().getType() == MainPlayer.PlayerType.AUDIO) {
toastText = R.string.background_player_already_playing_toast;
} else {
toastText = R.string.background_player_playing_toast;
}
Toast.makeText(context, toastText, Toast.LENGTH_SHORT)
.show();
final Intent intent = getPlayerIntent(context, MainPlayer.class, queue, resumePlayback);
intent.putExtra(Player.PLAYER_TYPE, MainPlayer.PlayerType.AUDIO.ordinal());
ContextCompat.startForegroundService(context, intent);