1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2026-04-26 00:31:22 +00:00

- Added move mechanic to background player through handles (on both thumbnail and icon).

- Added remove and open detail as long click popup dropdown on background player.
- Vastly simplified list manipulation in MediaSourceManager by delegating most control to DynamicConcatenatingMediaSource.
This commit is contained in:
John Zhen M
2017-10-08 22:43:07 -07:00
committed by John Zhen Mo
parent f5b5982e1c
commit 2e414cfd63
10 changed files with 254 additions and 108 deletions

View File

@@ -8,6 +8,7 @@ import org.reactivestreams.Subscription;
import org.schabi.newpipe.playlist.events.AppendEvent;
import org.schabi.newpipe.playlist.events.ErrorEvent;
import org.schabi.newpipe.playlist.events.InitEvent;
import org.schabi.newpipe.playlist.events.MoveEvent;
import org.schabi.newpipe.playlist.events.PlayQueueMessage;
import org.schabi.newpipe.playlist.events.RemoveEvent;
import org.schabi.newpipe.playlist.events.ReorderEvent;
@@ -272,6 +273,23 @@ public abstract class PlayQueue implements Serializable {
streams.remove(index);
}
public synchronized void move(final int source, final int target) {
if (source < 0 || target < 0) return;
if (source >= streams.size() || target >= streams.size()) return;
final int current = getIndex();
if (source == current) {
queueIndex.set(target);
} else if (source < current && target >= current) {
queueIndex.decrementAndGet();
} else if (source > current && target <= current) {
queueIndex.incrementAndGet();
}
streams.add(target, streams.remove(source));
broadcast(new MoveEvent(source, target));
}
/**
* Shuffles the current play queue.
*