Merge pull request #7224 from vhouriet/vhouriet_fix_check-background-player-type

Check if background player already active before displaying player toast
pull/7242/head
litetex 2021-10-12 19:47:50 +02:00 zatwierdzone przez GitHub
commit 9f7a8407ca
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4AEE18F83AFDEB23
1 zmienionych plików z 4 dodań i 2 usunięć

Wyświetl plik

@ -157,8 +157,10 @@ public final class NavigationHelper {
public static void playOnBackgroundPlayer(final Context context,
final PlayQueue queue,
final boolean resumePlayback) {
Toast.makeText(context, R.string.background_player_playing_toast, Toast.LENGTH_SHORT)
.show();
if (PlayerHolder.getInstance().getType() != MainPlayer.PlayerType.AUDIO) {
Toast.makeText(context, R.string.background_player_playing_toast, 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);