mirror of
https://github.com/TeamNewPipe/NewPipe
synced 2025-03-13 15:08:14 +00:00
slightly optimized model
This commit is contained in:
parent
3513f7ac03
commit
16a83dc448
@ -341,21 +341,22 @@ public abstract class PlayQueue implements Serializable {
|
||||
final int currentIndex = queueIndex.get();
|
||||
final int size = size();
|
||||
|
||||
int nextIndex = currentIndex;
|
||||
if (currentIndex > removeIndex) {
|
||||
queueIndex.decrementAndGet();
|
||||
nextIndex = currentIndex - 1;
|
||||
queueIndex.set(nextIndex);
|
||||
|
||||
} else if (currentIndex >= size) {
|
||||
queueIndex.set(currentIndex % (size - 1));
|
||||
nextIndex = currentIndex % (size - 1);
|
||||
queueIndex.set(nextIndex);
|
||||
|
||||
} else if (currentIndex == removeIndex && currentIndex == size - 1) {
|
||||
queueIndex.set(0);
|
||||
queueIndex.set(nextIndex = 0);
|
||||
}
|
||||
|
||||
if (backup != null) {
|
||||
backup.remove(getItem(removeIndex));
|
||||
}
|
||||
|
||||
final int nextIndex = queueIndex.get();
|
||||
history.remove(streams.remove(removeIndex));
|
||||
if (streams.size() > nextIndex) {
|
||||
history.add(streams.get(nextIndex));
|
||||
|
Loading…
x
Reference in New Issue
Block a user