Skip to content

Commit

Permalink
dummy shuffle added
Browse files Browse the repository at this point in the history
  • Loading branch information
ashrafzadeh committed Aug 20, 2018
1 parent 6ca4acb commit 430d952
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@

import java.util.ArrayList;
import java.util.List;
import java.util.Random;
import java.util.concurrent.Executors;
import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.ScheduledFuture;
Expand Down Expand Up @@ -166,6 +167,8 @@ public int lastSeekPosition() {
@Override
public void onSkipToNext() {
int nextIndex = index + 1;
if (shuffleEnable)
nextIndex = getRandomIndex();
if (!isValidIndex(true, nextIndex))
if (repeatEnable)
nextIndex = 0;
Expand All @@ -184,7 +187,8 @@ public void onSkipToNext() {
@Override
public void onSkipToPrevious() {
int prvIndex = index - 1;

if (shuffleEnable)
prvIndex = getRandomIndex();
if (!isValidIndex(true, prvIndex))
if (repeatEnable)
prvIndex = mediaList.size() - 1;
Expand All @@ -199,6 +203,11 @@ public void onSkipToPrevious() {
}
}


private int getRandomIndex() {
return new Random().nextInt(mediaList.size());
}

/**
* @return
*/
Expand Down

0 comments on commit 430d952

Please sign in to comment.