Fixes issue 111.
Instead of calling play() when the playlist is empty, show a toast
This commit is contained in:
parent
4eebe7be16
commit
f504e83cbf
2 changed files with 6 additions and 2 deletions
|
|
@ -298,7 +298,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
break;
|
break;
|
||||||
case ACTION_PLAY:
|
case ACTION_PLAY:
|
||||||
ArrayList<Song> songs = intent.getParcelableArrayListExtra(INTENT_EXTRA_SONGS);
|
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());
|
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) {
|
if (intent.hasExtra(INTENT_EXTRA_SHUFFLE_MODE) && intent.getIntExtra(INTENT_EXTRA_SHUFFLE_MODE, 0) == SHUFFLE_MODE_SHUFFLE) {
|
||||||
int startPosition = 0;
|
int startPosition = 0;
|
||||||
|
|
@ -310,8 +310,10 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
} else {
|
} else {
|
||||||
openQueue(songs, 0, false);
|
openQueue(songs, 0, false);
|
||||||
}
|
}
|
||||||
|
play();
|
||||||
|
} else {
|
||||||
|
Toast.makeText(getApplicationContext(), R.string.no_songs_in_playlist, Toast.LENGTH_LONG).show();
|
||||||
}
|
}
|
||||||
play();
|
|
||||||
break;
|
break;
|
||||||
case ACTION_REWIND:
|
case ACTION_REWIND:
|
||||||
back(true);
|
back(true);
|
||||||
|
|
|
||||||
|
|
@ -288,4 +288,6 @@
|
||||||
|
|
||||||
<string name="app_shortcut_last_added_long">@string/last_added</string>
|
<string name="app_shortcut_last_added_long">@string/last_added</string>
|
||||||
<string name="app_shortcut_last_added_short">@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>
|
</resources>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue