Fixes issue 111.

Instead of calling play() when the playlist is empty, show a toast
This commit is contained in:
Adrian Campos 2017-04-04 09:07:15 -07:00
commit f504e83cbf
2 changed files with 6 additions and 2 deletions

View file

@ -298,7 +298,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
break;
case ACTION_PLAY:
ArrayList<Song> songs = intent.getParcelableArrayListExtra(INTENT_EXTRA_SONGS);
if (songs != null) {
if (songs != null && !songs.isEmpty()) {
int shuffleMode = intent.getIntExtra(INTENT_EXTRA_SHUFFLE_MODE, getShuffleMode());
if (intent.hasExtra(INTENT_EXTRA_SHUFFLE_MODE) && intent.getIntExtra(INTENT_EXTRA_SHUFFLE_MODE, 0) == SHUFFLE_MODE_SHUFFLE) {
int startPosition = 0;
@ -310,8 +310,10 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
} else {
openQueue(songs, 0, false);
}
play();
} else {
Toast.makeText(getApplicationContext(), R.string.no_songs_in_playlist, Toast.LENGTH_LONG).show();
}
play();
break;
case ACTION_REWIND:
back(true);

View file

@ -288,4 +288,6 @@
<string name="app_shortcut_last_added_long">@string/last_added</string>
<string name="app_shortcut_last_added_short">@string/last_added</string>
<string name="no_songs_in_playlist">No songs in playlist</string>
</resources>