remove prepareNext()
This commit is contained in:
parent
4c17c5ecd5
commit
118a2752cb
1 changed files with 1 additions and 29 deletions
|
|
@ -104,7 +104,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
public static final int TRACK_ENDED = 2;
|
public static final int TRACK_ENDED = 2;
|
||||||
|
|
||||||
public static final int PLAY_SONG = 3;
|
public static final int PLAY_SONG = 3;
|
||||||
public static final int PREPARE_NEXT = 4;
|
|
||||||
|
|
||||||
public static final int SAVE_QUEUE = 0;
|
public static final int SAVE_QUEUE = 0;
|
||||||
public static final int LOAD_QUEUE = 9;
|
public static final int LOAD_QUEUE = 9;
|
||||||
|
|
@ -146,8 +145,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
@Override
|
@Override
|
||||||
public void onRepeatModeChanged() {
|
public void onRepeatModeChanged() {
|
||||||
notifyChange(REPEAT_MODE_CHANGED);
|
notifyChange(REPEAT_MODE_CHANGED);
|
||||||
// FIXME This call will be removed in a subsequent PR
|
|
||||||
prepareNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -168,7 +165,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
|
|
||||||
if (ready) {
|
if (ready) {
|
||||||
progressHandler.sendEmptyMessage(TRACK_STARTED);
|
progressHandler.sendEmptyMessage(TRACK_STARTED);
|
||||||
prepareNext();
|
|
||||||
} else if (reason == PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM) {
|
} else if (reason == PLAY_WHEN_READY_CHANGE_REASON_END_OF_MEDIA_ITEM) {
|
||||||
progressHandler.sendEmptyMessage(TRACK_ENDED);
|
progressHandler.sendEmptyMessage(TRACK_ENDED);
|
||||||
}
|
}
|
||||||
|
|
@ -183,7 +179,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
progressHandler.sendEmptyMessage(TRACK_CHANGED);
|
progressHandler.sendEmptyMessage(TRACK_CHANGED);
|
||||||
} else if (reason == MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED) {
|
} else if (reason == MEDIA_ITEM_TRANSITION_REASON_PLAYLIST_CHANGED) {
|
||||||
progressHandler.sendEmptyMessage(TRACK_CHANGED);
|
progressHandler.sendEmptyMessage(TRACK_CHANGED);
|
||||||
prepareNext();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
notifyChange(STATE_CHANGED);
|
notifyChange(STATE_CHANGED);
|
||||||
|
|
@ -492,7 +487,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
return playback != null && playback.isLoading();
|
return playback != null && playback.isLoading();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void playNextSong(boolean force) {
|
public void playNextSong(boolean force) {
|
||||||
playSongAt(queueManager.getNextPosition(force));
|
playSongAt(queueManager.getNextPosition(force));
|
||||||
}
|
}
|
||||||
|
|
@ -510,18 +504,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
playback.setDataSource(queueManager.getCurrentSong());
|
playback.setDataSource(queueManager.getCurrentSong());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void prepareNext() {
|
|
||||||
playerHandler.removeMessages(PREPARE_NEXT);
|
|
||||||
playerHandler.obtainMessage(PREPARE_NEXT).sendToTarget();
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized void prepareNextImpl() {
|
|
||||||
if (queueManager.getCurrentSong() == null) return;
|
|
||||||
|
|
||||||
queueManager.nextPosition = queueManager.getNextPosition(false);
|
|
||||||
playback.queueDataSource(queueManager.getSongAt(queueManager.nextPosition));
|
|
||||||
}
|
|
||||||
|
|
||||||
public void initNotification() {
|
public void initNotification() {
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !PreferenceUtil.getInstance(this).getClassicNotification()) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N && !PreferenceUtil.getInstance(this).getClassicNotification()) {
|
||||||
playingNotification = new PlayingNotificationNougat();
|
playingNotification = new PlayingNotificationNougat();
|
||||||
|
|
@ -716,9 +698,7 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
// because playing queue size might have changed
|
// because playing queue size might have changed
|
||||||
updateMediaSessionMetadata();
|
updateMediaSessionMetadata();
|
||||||
saveState();
|
saveState();
|
||||||
if (queueManager.getPlayingQueue().size() > 0) {
|
if (queueManager.getPlayingQueue().size() <= 0) {
|
||||||
prepareNext();
|
|
||||||
} else {
|
|
||||||
playback.pause();
|
playback.pause();
|
||||||
playingNotification.stop();
|
playingNotification.stop();
|
||||||
}
|
}
|
||||||
|
|
@ -777,10 +757,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
if (service.queueManager.getRepeatMode() == QueueManager.REPEAT_MODE_NONE && service.queueManager.isLastTrack()) {
|
if (service.queueManager.getRepeatMode() == QueueManager.REPEAT_MODE_NONE && service.queueManager.isLastTrack()) {
|
||||||
service.pause();
|
service.pause();
|
||||||
service.seek(0);
|
service.seek(0);
|
||||||
} else {
|
|
||||||
service.queueManager.position = service.queueManager.nextPosition;
|
|
||||||
service.prepareNextImpl();
|
|
||||||
service.notifyChange(QUEUE_CHANGED);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
@ -806,10 +782,6 @@ public class MusicService extends Service implements SharedPreferences.OnSharedP
|
||||||
case PLAY_SONG:
|
case PLAY_SONG:
|
||||||
service.openTrackAndPrepareNextAt(msg.arg1);
|
service.openTrackAndPrepareNextAt(msg.arg1);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PREPARE_NEXT:
|
|
||||||
service.prepareNextImpl();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue