Skip to content

Commit 989bcbf

Browse files
committed
Add Already playing in background toast
1 parent 19dd9d2 commit 989bcbf

2 files changed

Lines changed: 10 additions & 3 deletions

File tree

app/src/main/java/org/schabi/newpipe/util/NavigationHelper.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,16 @@ public static void playOnPopupPlayer(final Context context,
168168
public static void playOnBackgroundPlayer(final Context context,
169169
final PlayQueue queue,
170170
final boolean resumePlayback) {
171-
if (PlayerHolder.getInstance().getType() != MainPlayer.PlayerType.AUDIO) {
172-
Toast.makeText(context, R.string.background_player_playing_toast, Toast.LENGTH_SHORT)
173-
.show();
171+
final int toastText;
172+
if (PlayerHolder.getInstance().getType() == MainPlayer.PlayerType.AUDIO) {
173+
toastText = R.string.background_player_already_playing_toast;
174+
} else {
175+
toastText = R.string.background_player_playing_toast;
174176
}
177+
178+
Toast.makeText(context, toastText, Toast.LENGTH_SHORT)
179+
.show();
180+
175181
final Intent intent = getPlayerIntent(context, MainPlayer.class, queue, resumePlayback);
176182
intent.putExtra(Player.PLAYER_TYPE, MainPlayer.PlayerType.AUDIO.ordinal());
177183
ContextCompat.startForegroundService(context, intent);

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,7 @@
147147
<string name="settings_category_updates_title">Updates</string>
148148
<string name="settings_category_notification_title">Notification</string>
149149
<string name="background_player_playing_toast">Playing in background</string>
150+
<string name="background_player_already_playing_toast">Already playing in background</string>
150151
<string name="popup_playing_toast">Playing in popup mode</string>
151152
<string name="content">Content</string>
152153
<string name="show_age_restricted_content_title">Show age restricted content</string>

0 commit comments

Comments
 (0)