Merge pull request #400 from nitehu/fix/repeat_all_next

Fixed Next button behavior when Repeat All is enabled
This commit is contained in:
Nite 2021-03-19 19:52:27 +01:00 committed by GitHub
commit 031c969730
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 20 additions and 20 deletions

View File

@ -304,15 +304,8 @@ public class PlayerFragment extends Fragment implements GestureDetector.OnGestur
@Override
protected Boolean doInBackground()
{
if (mediaPlayerControllerLazy.getValue().getCurrentPlayingNumberOnPlaylist() < mediaPlayerControllerLazy.getValue().getPlaylistSize() - 1)
{
mediaPlayerControllerLazy.getValue().next();
return true;
}
else
{
return false;
}
mediaPlayerControllerLazy.getValue().next();
return true;
}
@Override
@ -1508,12 +1501,9 @@ public class PlayerFragment extends Fragment implements GestureDetector.OnGestur
if (e1X - e2X > swipeDistance && absX > swipeVelocity)
{
networkAndStorageChecker.getValue().warnIfNetworkOrStorageUnavailable();
if (mediaPlayerController.getCurrentPlayingNumberOnPlaylist() < mediaPlayerController.getPlaylistSize() - 1)
{
mediaPlayerController.next();
onCurrentChanged();
onSliderProgressChanged();
}
mediaPlayerController.next();
onCurrentChanged();
onSliderProgressChanged();
return true;
}

View File

@ -458,7 +458,20 @@ public class MediaPlayerControllerImpl implements MediaPlayerController
int index = downloader.getCurrentPlayingIndex();
if (index != -1)
{
play(index + 1);
switch (getRepeatMode())
{
case SINGLE:
case OFF:
if (index + 1 >= 0 && index + 1 < downloader.downloadList.size()) {
play(index + 1);
}
break;
case ALL:
play((index + 1) % downloader.downloadList.size());
break;
default:
break;
}
}
}

View File

@ -221,10 +221,7 @@ public class MediaPlayerLifecycleSupport
mediaPlayerController.previous();
break;
case KeyEvent.KEYCODE_MEDIA_NEXT:
if (downloader.getCurrentPlayingIndex() < downloader.downloadList.size() - 1)
{
mediaPlayerController.next();
}
mediaPlayerController.next();
break;
case KeyEvent.KEYCODE_MEDIA_STOP:
mediaPlayerController.stop();