Fix queue changing
This commit is contained in:
parent
69c76556a2
commit
891f1bce34
34 changed files with 1007 additions and 132 deletions
|
@ -331,7 +331,7 @@ public class MultiPlayer implements Playback, MediaPlayer.OnErrorListener, Media
|
|||
*/
|
||||
@Override
|
||||
public void onCompletion(final MediaPlayer mp) {
|
||||
if (mp == mCurrentMediaPlayer && mNextMediaPlayer != null) {
|
||||
if (mp.equals(mCurrentMediaPlayer) && mNextMediaPlayer != null) {
|
||||
mIsInitialized = false;
|
||||
mCurrentMediaPlayer.release();
|
||||
mCurrentMediaPlayer = mNextMediaPlayer;
|
||||
|
|
|
@ -752,45 +752,43 @@ public class MusicService extends Service implements
|
|||
|
||||
@Override
|
||||
public int onStartCommand(@Nullable Intent intent, int flags, int startId) {
|
||||
if (intent != null) {
|
||||
if (intent.getAction() != null) {
|
||||
restoreQueuesAndPositionIfNecessary();
|
||||
String action = intent.getAction();
|
||||
switch (action) {
|
||||
case ACTION_TOGGLE_PAUSE:
|
||||
if (isPlaying()) {
|
||||
pause();
|
||||
} else {
|
||||
play();
|
||||
}
|
||||
break;
|
||||
case ACTION_PAUSE:
|
||||
if (intent != null && intent.getAction() != null) {
|
||||
restoreQueuesAndPositionIfNecessary();
|
||||
String action = intent.getAction();
|
||||
switch (action) {
|
||||
case ACTION_TOGGLE_PAUSE:
|
||||
if (isPlaying()) {
|
||||
pause();
|
||||
break;
|
||||
case ACTION_PLAY:
|
||||
} else {
|
||||
play();
|
||||
break;
|
||||
case ACTION_PLAY_PLAYLIST:
|
||||
playFromPlaylist(intent);
|
||||
break;
|
||||
case ACTION_REWIND:
|
||||
back(true);
|
||||
break;
|
||||
case ACTION_SKIP:
|
||||
playNextSong(true);
|
||||
break;
|
||||
case ACTION_STOP:
|
||||
case ACTION_QUIT:
|
||||
pendingQuit = false;
|
||||
quit();
|
||||
break;
|
||||
case ACTION_PENDING_QUIT:
|
||||
pendingQuit = true;
|
||||
break;
|
||||
case TOGGLE_FAVORITE:
|
||||
MusicUtil.toggleFavorite(getApplicationContext(), getCurrentSong());
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ACTION_PAUSE:
|
||||
pause();
|
||||
break;
|
||||
case ACTION_PLAY:
|
||||
play();
|
||||
break;
|
||||
case ACTION_PLAY_PLAYLIST:
|
||||
playFromPlaylist(intent);
|
||||
break;
|
||||
case ACTION_REWIND:
|
||||
back(true);
|
||||
break;
|
||||
case ACTION_SKIP:
|
||||
playNextSong(true);
|
||||
break;
|
||||
case ACTION_STOP:
|
||||
case ACTION_QUIT:
|
||||
pendingQuit = false;
|
||||
quit();
|
||||
break;
|
||||
case ACTION_PENDING_QUIT:
|
||||
pendingQuit = true;
|
||||
break;
|
||||
case TOGGLE_FAVORITE:
|
||||
MusicUtil.toggleFavorite(getApplicationContext(), getCurrentSong());
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue