Disable repeat option when there are no songs
This commit is contained in:
parent
cf776d40bb
commit
cb1221e00c
@ -310,6 +310,8 @@ public class PlaybackActivity extends Activity implements Handler.Callback, View
|
||||
menu.findItem(MENU_SHUFFLE).setTitle(isShuffling ? R.string.shuffle_disable : R.string.shuffle_enable);
|
||||
boolean isRepeating = (mState & PlaybackService.FLAG_REPEAT) != 0;
|
||||
menu.findItem(MENU_REPEAT).setTitle(isRepeating ? R.string.repeat_disable : R.string.repeat_enable);
|
||||
if ((mState & PlaybackService.FLAG_NO_MEDIA) != 0)
|
||||
menu.findItem(MENU_REPEAT).setEnabled(false);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -431,9 +431,6 @@ public final class PlaybackService extends Service implements Handler.Callback,
|
||||
Toast.makeText(this, text, Toast.LENGTH_LONG).show();
|
||||
}
|
||||
|
||||
if (mCurrentSong == null)
|
||||
state &= ~FLAG_REPEAT;
|
||||
|
||||
int oldState = mState;
|
||||
mState = state;
|
||||
|
||||
|
@ -238,10 +238,13 @@ public final class SongTimeline {
|
||||
|
||||
synchronized (this) {
|
||||
if (repeat) {
|
||||
Song song = getSong(0);
|
||||
if (song == null)
|
||||
return;
|
||||
mRepeatStart = mCurrentPos;
|
||||
// Ensure that we will at least repeat one song (the current song),
|
||||
// even if all of our songs were selected randomly.
|
||||
getSong(0).flags &= ~Song.FLAG_RANDOM;
|
||||
song.flags &= ~Song.FLAG_RANDOM;
|
||||
} else {
|
||||
mRepeatStart = -1;
|
||||
mRepeatedSongs = null;
|
||||
|
Loading…
x
Reference in New Issue
Block a user